@@ -123,6 +123,53 @@ describe("ArrayField", () => {
123123 } ) ; 
124124 } ) ; 
125125
126+  describe ( "Malformed nested array formData" ,  ( )  =>  { 
127+  const  schema  =  { 
128+  type : "object" , 
129+  properties : { 
130+  foo : { 
131+  type : "array" , 
132+  items : {  type : "string"  } , 
133+  } , 
134+  } , 
135+  } ; 
136+ 
137+  it ( "should contain no field in the list when nested array formData is explicitly null" ,  ( )  =>  { 
138+  const  {  node }  =  createFormComponent ( { 
139+  schema, 
140+  formData : {  foo : null  } , 
141+  } ) ; 
142+  expect ( node . querySelectorAll ( ".field-string" ) ) . to . have . length . of ( 0 ) ; 
143+  } ) ; 
144+  } ) ; 
145+ 
146+  describe ( "Nullable array formData" ,  ( )  =>  { 
147+  const  schema  =  { 
148+  type : "object" , 
149+  properties : { 
150+  foo : { 
151+  type : [ "array" ,  "null" ] , 
152+  items : {  type : "string"  } , 
153+  } , 
154+  } , 
155+  } ; 
156+ 
157+  it ( "should contain no field in the list when nested array formData is explicitly null" ,  ( )  =>  { 
158+  const  {  node }  =  createFormComponent ( { 
159+  schema, 
160+  formData : {  foo : null  } , 
161+  } ) ; 
162+  expect ( node . querySelectorAll ( ".field-string" ) ) . to . have . length . of ( 0 ) ; 
163+  } ) ; 
164+  it ( "should contain a field in the list when nested array formData is a single item" ,  ( )  =>  { 
165+  const  {  node }  =  createFormComponent ( { 
166+  schema, 
167+  formData : {  foo : [ "test" ]  } , 
168+  } ) ; 
169+  expect ( node . querySelectorAll ( ".field-string" ) ) . to . have . length . of ( 1 ) ; 
170+  } ) ; 
171+  } ) ; 
172+ 
126173 describe ( "List of inputs" ,  ( )  =>  { 
127174 const  schema  =  { 
128175 type : "array" , 
0 commit comments