@@ -98,7 +98,7 @@ const renderForm = (props, options = {}) =>
98
98
render (
99
99
< DForm
100
100
form = { form }
101
- initialSectionIndex = { 0 }
101
+ sectionIndex = { options . initialSectionIndex || 0 }
102
102
answers = { [ ] }
103
103
formikValues = { { } }
104
104
formikTouched = { { } }
@@ -199,7 +199,7 @@ const renderForm = (props, options = {}) =>
199
199
)
200
200
201
201
test ( 'renders form section' , async ( ) => {
202
- renderForm ( { initialSectionIndex : 1 } )
202
+ renderForm ( null , { initialSectionIndex : 1 } )
203
203
expect ( screen . queryByTestId ( 'field-1' ) ) . toHaveTextContent ( 'I am a text field' )
204
204
expect ( screen . queryByTestId ( 'field-2' ) ) . toHaveTextContent (
205
205
'I am a number field'
@@ -216,7 +216,7 @@ test('renders form section', async () => {
216
216
} )
217
217
218
218
test ( 'move between sections and validate' , async ( ) => {
219
- renderForm ( { initialSectionIndex : 0 } )
219
+ renderForm ( )
220
220
expect ( screen . queryByTestId ( 'field-8' ) ) . toHaveTextContent ( 'I am a text field' )
221
221
expect ( screen . queryByTestId ( 'section-1' ) ) . toHaveTextContent ( 'IS VALID' )
222
222
userEvent . click ( screen . queryByTestId ( 'move-to-next-section' ) )
@@ -240,7 +240,7 @@ test('move between sections and validate', async () => {
240
240
} )
241
241
242
242
test ( 'values persitance when moving through sections' , async ( ) => {
243
- renderForm ( { initialSectionIndex : 0 } )
243
+ renderForm ( ) ;
244
244
userEvent . type ( screen . queryByTestId ( 'field-input-8' ) , 'Some text answer 8' )
245
245
userEvent . click ( screen . queryByTestId ( 'move-to-next-section' ) )
246
246
userEvent . type ( screen . queryByTestId ( 'field-input-1' ) , 'Some text answer 1' )
@@ -262,7 +262,6 @@ test('form submit value map to answers', async () => {
262
262
const onSubmit = jest . fn ( )
263
263
renderForm (
264
264
{
265
- initialSectionIndex : 0 ,
266
265
onSubmit,
267
266
} ,
268
267
{
0 commit comments