File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
packages/ra-core/src/form Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -114,5 +114,23 @@ describe('useFormIsDirty', () => {
114114 } ;
115115 expect ( checkHasDirtyFields ( dirtyFields ) ) . toBe ( false ) ;
116116 } ) ;
117+
118+ it ( 'should return true when an array contains an empty object (new item)' , ( ) => {
119+ const dirtyFields = {
120+ name : false ,
121+ age : false ,
122+ hobbies : [ { } ] , // empty object should be considered dirty
123+ } ;
124+ expect ( checkHasDirtyFields ( dirtyFields ) ) . toBe ( true ) ;
125+ } ) ;
126+
127+ it ( 'should return true when an array contains undefined entries (new item)' , ( ) => {
128+ const dirtyFields = {
129+ name : false ,
130+ age : false ,
131+ hobbies : [ undefined ] , // undefined should be considered dirty
132+ } as any ;
133+ expect ( checkHasDirtyFields ( dirtyFields ) ) . toBe ( true ) ;
134+ } ) ;
117135 } ) ;
118136} ) ;
You can’t perform that action at this time.
0 commit comments