File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -888,4 +888,35 @@ describe('field group api', () => {
888
888
'Error' ,
889
889
] )
890
890
} )
891
+
892
+ it ( 'should generate form field names properly with nested objects' , ( ) => {
893
+ // https://github.com/TanStack/form/issues/1645
894
+ const form = new FormApi ( {
895
+ defaultValues : {
896
+ complexValue : {
897
+ prop1 : 0 ,
898
+ prop2 : 0 ,
899
+ } ,
900
+ } ,
901
+ } )
902
+ form . mount ( )
903
+
904
+ const group = new FieldGroupApi ( {
905
+ defaultValues : {
906
+ complexValue : {
907
+ prop1 : 0 ,
908
+ prop2 : 0 ,
909
+ } ,
910
+ } ,
911
+ form,
912
+ fields : {
913
+ complexValue : 'complexValue' ,
914
+ } ,
915
+ } )
916
+ group . mount ( )
917
+
918
+ expect ( group . getFormFieldName ( 'complexValue.prop1' ) ) . toBe (
919
+ 'complexValue.prop1' ,
920
+ )
921
+ } )
891
922
} )
You can’t perform that action at this time.
0 commit comments