@@ -21,32 +21,32 @@ const generateFormWithOptionalParameter = (initialText = "default") =>
21
21
describe ( "formsField" , ( ) => {
22
22
test ( "initialize formsField with generateForm function" , ( ) => {
23
23
const formsFieldObject1 = formsField ( generateFormWithNoParameter , 3 ) ;
24
- expect ( formsFieldObject1 . $forms [ 0 ] . text . $value ) . toBe ( "" ) ;
25
- expect ( formsFieldObject1 . $forms [ 1 ] . text . $value ) . toBe ( "" ) ;
26
- expect ( formsFieldObject1 . $forms [ 2 ] . text . $value ) . toBe ( "" ) ;
24
+ expect ( formsFieldObject1 . $forms [ 0 ] ! . text . $value ) . toBe ( "" ) ;
25
+ expect ( formsFieldObject1 . $forms [ 1 ] ! . text . $value ) . toBe ( "" ) ;
26
+ expect ( formsFieldObject1 . $forms [ 2 ] ! . text . $value ) . toBe ( "" ) ;
27
27
28
28
const formsFieldObject2 = formsField ( generateFormWithRequiredParameter , [
29
29
"A" ,
30
30
"B" ,
31
31
"C" ,
32
32
] ) ;
33
- expect ( formsFieldObject2 . $forms [ 0 ] . text . $value ) . toBe ( "A" ) ;
34
- expect ( formsFieldObject2 . $forms [ 1 ] . text . $value ) . toBe ( "B" ) ;
35
- expect ( formsFieldObject2 . $forms [ 2 ] . text . $value ) . toBe ( "C" ) ;
33
+ expect ( formsFieldObject2 . $forms [ 0 ] ! . text . $value ) . toBe ( "A" ) ;
34
+ expect ( formsFieldObject2 . $forms [ 1 ] ! . text . $value ) . toBe ( "B" ) ;
35
+ expect ( formsFieldObject2 . $forms [ 2 ] ! . text . $value ) . toBe ( "C" ) ;
36
36
37
37
const formsFieldObject3 = formsField ( generateFormWithOptionalParameter , 3 ) ;
38
- expect ( formsFieldObject3 . $forms [ 0 ] . text . $value ) . toBe ( "default" ) ;
39
- expect ( formsFieldObject3 . $forms [ 1 ] . text . $value ) . toBe ( "default" ) ;
40
- expect ( formsFieldObject3 . $forms [ 2 ] . text . $value ) . toBe ( "default" ) ;
38
+ expect ( formsFieldObject3 . $forms [ 0 ] ! . text . $value ) . toBe ( "default" ) ;
39
+ expect ( formsFieldObject3 . $forms [ 1 ] ! . text . $value ) . toBe ( "default" ) ;
40
+ expect ( formsFieldObject3 . $forms [ 2 ] ! . text . $value ) . toBe ( "default" ) ;
41
41
42
42
const formsFieldObject4 = formsField ( generateFormWithOptionalParameter , [
43
43
"A" ,
44
44
undefined ,
45
45
"C" ,
46
46
] ) ;
47
- expect ( formsFieldObject4 . $forms [ 0 ] . text . $value ) . toBe ( "A" ) ;
48
- expect ( formsFieldObject4 . $forms [ 1 ] . text . $value ) . toBe ( "default" ) ;
49
- expect ( formsFieldObject4 . $forms [ 2 ] . text . $value ) . toBe ( "C" ) ;
47
+ expect ( formsFieldObject4 . $forms [ 0 ] ! . text . $value ) . toBe ( "A" ) ;
48
+ expect ( formsFieldObject4 . $forms [ 1 ] ! . text . $value ) . toBe ( "default" ) ;
49
+ expect ( formsFieldObject4 . $forms [ 2 ] ! . text . $value ) . toBe ( "C" ) ;
50
50
} ) ;
51
51
52
52
test ( "no schema was given" , ( ) => {
@@ -82,7 +82,7 @@ describe("formsField", () => {
82
82
) ;
83
83
expect ( formsFieldObject . $error ) . toBeUndefined ( ) ;
84
84
85
- formsFieldObject . $forms [ 2 ] . text . $value += "k" ;
85
+ formsFieldObject . $forms [ 2 ] ! . text . $value += "k" ;
86
86
expect ( formsFieldObject . $error ) . toBeInstanceOf ( yup . ValidationError ) ;
87
87
} ) ;
88
88
@@ -191,36 +191,36 @@ describe("formsField", () => {
191
191
192
192
formsFieldObject . $initialize ( [ "A" , "B" , "C" ] ) ;
193
193
expect ( formsFieldObject . $forms ) . toHaveLength ( 3 ) ;
194
- expect ( formsFieldObject . $forms [ 0 ] . text . $value ) . toBe ( "A" ) ;
195
- expect ( formsFieldObject . $forms [ 1 ] . text . $value ) . toBe ( "B" ) ;
196
- expect ( formsFieldObject . $forms [ 2 ] . text . $value ) . toBe ( "C" ) ;
194
+ expect ( formsFieldObject . $forms [ 0 ] ! . text . $value ) . toBe ( "A" ) ;
195
+ expect ( formsFieldObject . $forms [ 1 ] ! . text . $value ) . toBe ( "B" ) ;
196
+ expect ( formsFieldObject . $forms [ 2 ] ! . text . $value ) . toBe ( "C" ) ;
197
197
198
198
formsFieldObject . $initialize ( ) ;
199
199
expect ( formsFieldObject . $forms ) . toHaveLength ( 0 ) ;
200
200
201
201
formsFieldObject . $initialize ( 3 ) ;
202
202
expect ( formsFieldObject . $forms ) . toHaveLength ( 3 ) ;
203
- expect ( formsFieldObject . $forms [ 0 ] . text . $value ) . toBe ( "default" ) ;
204
- expect ( formsFieldObject . $forms [ 1 ] . text . $value ) . toBe ( "default" ) ;
205
- expect ( formsFieldObject . $forms [ 2 ] . text . $value ) . toBe ( "default" ) ;
203
+ expect ( formsFieldObject . $forms [ 0 ] ! . text . $value ) . toBe ( "default" ) ;
204
+ expect ( formsFieldObject . $forms [ 1 ] ! . text . $value ) . toBe ( "default" ) ;
205
+ expect ( formsFieldObject . $forms [ 2 ] ! . text . $value ) . toBe ( "default" ) ;
206
206
} ) ;
207
207
test ( "parameter of $append()" , async ( ) => {
208
208
const formsFieldObject = formsField ( generateFormWithOptionalParameter ) ;
209
209
210
210
formsFieldObject . $append ( ) ;
211
- expect ( formsFieldObject . $forms [ 0 ] . text . $value ) . toBe ( "default" ) ;
211
+ expect ( formsFieldObject . $forms [ 0 ] ! . text . $value ) . toBe ( "default" ) ;
212
212
213
213
formsFieldObject . $append ( "hello" ) ;
214
- expect ( formsFieldObject . $forms [ 1 ] . text . $value ) . toBe ( "hello" ) ;
214
+ expect ( formsFieldObject . $forms [ 1 ] ! . text . $value ) . toBe ( "hello" ) ;
215
215
} ) ;
216
216
test ( "parameter of $prepend()" , async ( ) => {
217
217
const formsFieldObject = formsField ( generateFormWithOptionalParameter ) ;
218
218
219
219
formsFieldObject . $prepend ( ) ;
220
- expect ( formsFieldObject . $forms [ 0 ] . text . $value ) . toBe ( "default" ) ;
220
+ expect ( formsFieldObject . $forms [ 0 ] ! . text . $value ) . toBe ( "default" ) ;
221
221
222
222
formsFieldObject . $prepend ( "hello" ) ;
223
- expect ( formsFieldObject . $forms [ 0 ] . text . $value ) . toBe ( "hello" ) ;
223
+ expect ( formsFieldObject . $forms [ 0 ] ! . text . $value ) . toBe ( "hello" ) ;
224
224
} ) ;
225
225
test ( "parameter of $remove()" , async ( ) => {
226
226
const formsFieldObject = formsField ( generateFormWithOptionalParameter , 5 ) ;
0 commit comments