@@ -1095,20 +1095,31 @@ describe("VueFormGenerator.vue", () => {
1095
1095
} ) ;
1096
1096
1097
1097
it ( "should return true" , ( ) => {
1098
- expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "checkbox" } ) ) . to . be . true ;
1099
- expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "text" } ) ) . to . be . true ;
1100
- expect ( form . fieldTypeHasLabel ( { type : "checklist" } ) ) . to . be . true ;
1101
- expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "image" } ) ) . to . be . true ;
1098
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "checkbox" , label : "checkbox" } ) ) . to . be . true ;
1099
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "text" , label : "text" } ) ) . to . be . true ;
1100
+ expect ( form . fieldTypeHasLabel ( { type : "checklist" , label : "checklist" } ) ) . to . be . true ;
1101
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "image" , label : "image" } ) ) . to . be . true ;
1102
1102
} ) ;
1103
1103
1104
1104
it ( "should return false" , ( ) => {
1105
+ // with label text defined
1106
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "button" , label : "button" } ) ) . to . be . false ;
1107
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "submit" , label : "submit" } ) ) . to . be . false ;
1108
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "reset" , label : "reset" } ) ) . to . be . false ;
1109
+
1110
+ // without label text defined
1111
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "checkbox" } ) ) . to . be . false ;
1112
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "text" } ) ) . to . be . false ;
1113
+ expect ( form . fieldTypeHasLabel ( { type : "checklist" } ) ) . to . be . false ;
1114
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "image" } ) ) . to . be . false ;
1105
1115
expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "button" } ) ) . to . be . false ;
1106
1116
expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "submit" } ) ) . to . be . false ;
1107
1117
expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "reset" } ) ) . to . be . false ;
1108
1118
} ) ;
1109
1119
1110
1120
it ( "should default to true for unknown types" , ( ) => {
1111
- expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "unsupported-or-unknown" } ) ) . to . be . true ;
1121
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "unsupported-or-unknown" , label :"unsupported" } ) ) . to . be . true ;
1122
+ expect ( form . fieldTypeHasLabel ( { type : "input" , inputType : "unsupported-or-unknown" } ) ) . to . be . false ;
1112
1123
} ) ;
1113
1124
} ) ;
1114
1125
0 commit comments