@@ -186,11 +186,13 @@ describe('<Wizard />', () => {
186
186
expect ( onSubmit ) . toHaveBeenCalled ( ) ;
187
187
} ) ;
188
188
189
- it ( 'should go to next step correctly and submit data' , ( ) => {
189
+ it ( 'should go to next step correctly and submit data and formOptions ' , ( ) => {
190
190
const onSubmit = jest . fn ( ) ;
191
+ const formOptions = { ...initialProps . formOptions , onSubmit, getRegisteredFields : getRegisteredFieldsSchemaMock } ;
192
+
191
193
const wrapper = mount ( < Wizard
192
194
{ ...initialProps }
193
- formOptions = { { ... initialProps . formOptions , onSubmit , getRegisteredFields : getRegisteredFieldsSchemaMock } }
195
+ formOptions = { formOptions }
194
196
fields = { schema }
195
197
/> ) ;
196
198
nextButtonClickWithHeader ( wrapper ) ;
@@ -203,7 +205,7 @@ describe('<Wizard />', () => {
203
205
expect ( onSubmit ) . toHaveBeenCalledWith ( {
204
206
'foo-field' : 'foo-field-value' ,
205
207
'bar-field' : 'bar-field-value' ,
206
- } ) ;
208
+ } , formOptions ) ;
207
209
} ) ;
208
210
209
211
it ( 'should pass values to cancel button' , ( ) => {
@@ -234,9 +236,16 @@ describe('<Wizard />', () => {
234
236
235
237
it ( 'should submit data when nested schema' , ( ) => {
236
238
const onSubmit = jest . fn ( ) ;
239
+ const formOptions = {
240
+ ...initialProps . formOptions ,
241
+ onSubmit,
242
+ getRegisteredFields : getRegisteredFieldsNestedSchemaMock ,
243
+ getState : getValuesNestedSchema ,
244
+ } ;
245
+
237
246
const wrapper = mount ( < Wizard
238
247
{ ...initialProps }
239
- formOptions = { { ... initialProps . formOptions , onSubmit , getRegisteredFields : getRegisteredFieldsNestedSchemaMock , getState : getValuesNestedSchema } }
248
+ formOptions = { formOptions }
240
249
fields = { nestedSchema }
241
250
/> ) ;
242
251
@@ -250,7 +259,7 @@ describe('<Wizard />', () => {
250
259
'bar-field' : 'bar-field-value' ,
251
260
} ,
252
261
} ,
253
- } ) ;
262
+ } , formOptions ) ;
254
263
} ) ;
255
264
256
265
it ( 'should build simple navigation' , ( ) => {
0 commit comments