@@ -1018,23 +1018,27 @@ describe("VueFormGenerator.vue", () => {
1018
1018
} ) ;
1019
1019
1020
1020
describe ( "check fieldTypeHasLabel function" , ( ) => {
1021
+ let form ;
1021
1022
before ( ( ) => {
1022
1023
createFormGenerator ( { fields : [ ] } , { } ) ;
1024
+ form = vm . $refs . form ;
1023
1025
} ) ;
1024
1026
1025
-
1026
1027
it ( "should return true" , ( ) => {
1027
- console . log ( vm ) ;
1028
- expect ( vm . fieldTypeHasLabel ( { type : "input" , inputType : "checkbox" } ) ) . to . be . true ;
1029
- expect ( vm . fieldTypeHasLabel ( { type : "input" , inputType : "text" } ) ) . to . be . true ;
1030
- expect ( vm . fieldTypeHasLabel ( { type : "checklist" } ) ) . to . be . true ;
1028
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "checkbox" } ) ) . to . be . true ;
1029
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "text" } ) ) . to . be . true ;
1030
+ expect ( form . fieldTypeHasLabel ( { type : "checklist" } ) ) . to . be . true ;
1031
1031
} ) ;
1032
1032
1033
1033
it ( "should return false" , ( ) => {
1034
- expect ( vm . fieldTypeHasLabel ( { type : "input" , inputType : "button" } ) ) . to . be . false ;
1035
- expect ( vm . fieldTypeHasLabel ( { type : "input" , inputType : "image" } ) ) . to . be . false ;
1036
- expect ( vm . fieldTypeHasLabel ( { type : "input" , inputType : "submit" } ) ) . to . be . false ;
1037
- expect ( vm . fieldTypeHasLabel ( { type : "input" , inputType : "reset" } ) ) . to . be . false ;
1034
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "button" } ) ) . to . be . false ;
1035
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "image" } ) ) . to . be . false ;
1036
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "submit" } ) ) . to . be . false ;
1037
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "reset" } ) ) . to . be . false ;
1038
+ } ) ;
1039
+
1040
+ it ( "should default to true for unknown types" , ( ) => {
1041
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "unsupported-or-unknown" } ) ) . to . be . true ;
1038
1042
} ) ;
1039
1043
} ) ;
1040
1044
0 commit comments