@@ -18,7 +18,11 @@ import { SimpleForm } from '../../form';
1818import { ArrayInput } from './ArrayInput' ;
1919import { TextInput } from '../TextInput' ;
2020import { SimpleFormIterator } from './SimpleFormIterator' ;
21- import { Basic } from './SimpleFormIterator.stories' ;
21+ import {
22+ Basic ,
23+ DefaultValue ,
24+ DefaultValueWithFormDataConsumer ,
25+ } from './SimpleFormIterator.stories' ;
2226
2327describe ( '<SimpleFormIterator />' , ( ) => {
2428 // bypass confirm leave form with unsaved changes
@@ -418,22 +422,7 @@ describe('<SimpleFormIterator />', () => {
418422 } ) ;
419423
420424 it ( 'should not reapply default values set at form level after removing and then re-adding one row' , async ( ) => {
421- render (
422- < Wrapper >
423- < SimpleForm
424- defaultValues = { {
425- emails :
[ { email :
'[email protected] ' , name :
'test' } ] , 426- } }
427- >
428- < ArrayInput source = "emails" >
429- < SimpleFormIterator >
430- < TextInput source = "email" label = "Email" />
431- < TextInput source = "name" label = "Name" />
432- </ SimpleFormIterator >
433- </ ArrayInput >
434- </ SimpleForm >
435- </ Wrapper >
436- ) ;
425+ render ( < DefaultValue /> ) ;
437426
438427 const removeFirstButton = getByLabelText (
439428 // @ts -ignore
@@ -479,32 +468,7 @@ describe('<SimpleFormIterator />', () => {
479468 } ) ;
480469
481470 it ( 'should not reapply default values set at form level after removing and then re-adding one row, even with FormDataConsumer' , async ( ) => {
482- render (
483- < Wrapper >
484- < SimpleForm
485- defaultValues = { {
486- emails :
[ { email :
'[email protected] ' , name :
'test' } ] , 487- } }
488- >
489- < ArrayInput source = "emails" >
490- < SimpleFormIterator >
491- < FormDataConsumer >
492- { ( ) => (
493- < >
494- < TextInput
495- source = "email"
496- label = "Email"
497- 498- />
499- < TextInput source = "name" label = "Name" />
500- </ >
501- ) }
502- </ FormDataConsumer >
503- </ SimpleFormIterator >
504- </ ArrayInput >
505- </ SimpleForm >
506- </ Wrapper >
507- ) ;
471+ render ( < DefaultValueWithFormDataConsumer /> ) ;
508472
509473 const removeFirstButton = getByLabelText (
510474 // @ts -ignore
0 commit comments