@@ -885,6 +885,10 @@ describe('Form.Basic', () => {
885
885
Array . from ( container . querySelectorAll < HTMLInputElement > ( 'input' ) ) . map ( input => input ?. value ) ,
886
886
) . toEqual ( [ 'bamboo' , 'little' , 'light' , 'nested' ] ) ;
887
887
888
+ // Check initial touched state
889
+ expect ( formRef . current . isFieldTouched ( [ 'list' , 1 ] ) ) . toBeFalsy ( ) ;
890
+ expect ( formRef . current . isFieldTouched ( [ 'nest' , 'target' ] ) ) . toBeFalsy ( ) ;
891
+
888
892
// Set
889
893
act ( ( ) => {
890
894
formRef . current . setFieldValue ( [ 'list' , 1 ] , 'tiny' ) ;
@@ -894,6 +898,15 @@ describe('Form.Basic', () => {
894
898
expect (
895
899
Array . from ( container . querySelectorAll < HTMLInputElement > ( 'input' ) ) . map ( input => input ?. value ) ,
896
900
) . 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 ( ) ;
897
910
} ) ;
898
911
899
912
it ( 'onMetaChange should only trigger when meta changed' , ( ) => {
0 commit comments