@@ -726,10 +726,10 @@ describe("form component utilities", () => {
726726 expect ( buildNestedState ( inputs , formData ) ) . toEqual ( { col : [ 1 , 2 , 5 ] } ) ;
727727 } ) ;
728728
729- it ( "should preserve data_column null/empty/ undefined values " , ( ) => {
729+ it ( "should convert cleared data_column values to null but keep undefined as-is " , ( ) => {
730730 const inputs = [ { name : "col" , type : "data_column" } ] ;
731731 expect ( buildNestedState ( inputs , { col : null } ) ) . toEqual ( { col : null } ) ;
732- expect ( buildNestedState ( inputs , { col : "" } ) ) . toEqual ( { col : "" } ) ;
732+ expect ( buildNestedState ( inputs , { col : "" } ) ) . toEqual ( { col : null } ) ;
733733 expect ( buildNestedState ( inputs , { col : undefined } ) ) . toEqual ( { col : undefined } ) ;
734734 } ) ;
735735
@@ -744,10 +744,10 @@ describe("form component utilities", () => {
744744 expect ( buildNestedState ( inputs , { num : "42" } ) ) . toEqual ( { num : 42 } ) ;
745745 } ) ;
746746
747- it ( "should preserve integer null/empty/ undefined values " , ( ) => {
747+ it ( "should convert cleared integer values to null but keep undefined as-is " , ( ) => {
748748 const inputs = [ { name : "num" , type : "integer" } ] ;
749749 expect ( buildNestedState ( inputs , { num : null } ) ) . toEqual ( { num : null } ) ;
750- expect ( buildNestedState ( inputs , { num : "" } ) ) . toEqual ( { num : "" } ) ;
750+ expect ( buildNestedState ( inputs , { num : "" } ) ) . toEqual ( { num : null } ) ;
751751 expect ( buildNestedState ( inputs , { num : undefined } ) ) . toEqual ( { num : undefined } ) ;
752752 } ) ;
753753
@@ -761,10 +761,10 @@ describe("form component utilities", () => {
761761 expect ( buildNestedState ( inputs , { val : "3.14" } ) ) . toEqual ( { val : 3.14 } ) ;
762762 } ) ;
763763
764- it ( "should preserve float null/empty/ undefined values " , ( ) => {
764+ it ( "should convert cleared float values to null but keep undefined as-is " , ( ) => {
765765 const inputs = [ { name : "val" , type : "float" } ] ;
766766 expect ( buildNestedState ( inputs , { val : null } ) ) . toEqual ( { val : null } ) ;
767- expect ( buildNestedState ( inputs , { val : "" } ) ) . toEqual ( { val : "" } ) ;
767+ expect ( buildNestedState ( inputs , { val : "" } ) ) . toEqual ( { val : null } ) ;
768768 expect ( buildNestedState ( inputs , { val : undefined } ) ) . toEqual ( { val : undefined } ) ;
769769 } ) ;
770770
0 commit comments