File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -1042,4 +1042,37 @@ describe('Form.List', () => {
10421042
10431043 expect ( onFinishFailed ) . toHaveBeenCalled ( ) ;
10441044 } ) ;
1045+
1046+ it ( 'List should have correct onValuesChange' , ( ) => {
1047+ const onValuesChange = jest . fn ( ) ;
1048+
1049+ const [ container ] = generateForm (
1050+ fields => (
1051+ < div >
1052+ { fields . map ( field => (
1053+ < div key = { field . key } >
1054+ < Field { ...field } name = { [ field . name , 'first' ] } >
1055+ < Input />
1056+ </ Field >
1057+ < Field { ...field } name = { [ field . name , 'last' ] } >
1058+ < Input />
1059+ </ Field >
1060+ </ div >
1061+ ) ) }
1062+ </ div >
1063+ ) ,
1064+ {
1065+ initialValues : {
1066+ list : [ { first : 'light' } ] ,
1067+ } ,
1068+ onValuesChange,
1069+ } ,
1070+ ) ;
1071+
1072+ fireEvent . change ( getInput ( container , 1 ) , { target : { value : 'little' } } ) ;
1073+ expect ( onValuesChange ) . toHaveBeenCalledWith (
1074+ { list : [ { last : 'little' } ] } ,
1075+ { list : [ { first : 'light' , last : 'little' } ] } ,
1076+ ) ;
1077+ } ) ;
10451078} ) ;
You can’t perform that action at this time.
0 commit comments