@@ -885,6 +885,10 @@ describe('Form.Basic', () => {
885885 Array . from ( container . querySelectorAll < HTMLInputElement > ( 'input' ) ) . map ( input => input ?. value ) ,
886886 ) . toEqual ( [ 'bamboo' , 'little' , 'light' , 'nested' ] ) ;
887887
888+ // Check initial touched state
889+ expect ( formRef . current . isFieldTouched ( [ 'list' , 1 ] ) ) . toBeFalsy ( ) ;
890+ expect ( formRef . current . isFieldTouched ( [ 'nest' , 'target' ] ) ) . toBeFalsy ( ) ;
891+
888892 // Set
889893 act ( ( ) => {
890894 formRef . current . setFieldValue ( [ 'list' , 1 ] , 'tiny' ) ;
@@ -894,6 +898,15 @@ describe('Form.Basic', () => {
894898 expect (
895899 Array . from ( container . querySelectorAll < HTMLInputElement > ( 'input' ) ) . map ( input => input ?. value ) ,
896900 ) . toEqual ( [ 'bamboo' , 'tiny' , 'light' , 'match' ] ) ;
901+
902+ // Check that setFieldValue DOES set touched to true
903+ // (setFieldValue internally calls setFields with touched: true)
904+ expect ( formRef . current . isFieldTouched ( [ 'list' , 1 ] ) ) . toBeTruthy ( ) ;
905+ expect ( formRef . current . isFieldTouched ( [ 'nest' , 'target' ] ) ) . toBeTruthy ( ) ;
906+
907+ // Verify other fields remain untouched
908+ expect ( formRef . current . isFieldTouched ( [ 'list' , 0 ] ) ) . toBeFalsy ( ) ;
909+ expect ( formRef . current . isFieldTouched ( [ 'list' , 2 ] ) ) . toBeFalsy ( ) ;
897910 } ) ;
898911
899912 it ( 'onMetaChange should only trigger when meta changed' , ( ) => {
0 commit comments