@@ -281,7 +281,32 @@ describe('ArrayInput', () => {
281281 expect ( deleteButtons [ 1 ] ) . toBeDisabled ( )
282282 } )
283283
284- // Test 11: itemParameters prop overrides inputParam.array display flags
284+ // Test 11: Type-specific defaults when no explicit default is provided
285+ it ( 'should initialize new items with type-appropriate defaults when no default is specified' , ( ) => {
286+ const inputParamWithTypes : InputParam = {
287+ id : 'typed-array' ,
288+ name : 'testArray' ,
289+ label : 'Test Item' ,
290+ type : 'array' ,
291+ array : [
292+ { id : 'str' , name : 'str' , label : 'String' , type : 'string' } as InputParam ,
293+ { id : 'num' , name : 'num' , label : 'Number' , type : 'number' } as InputParam ,
294+ { id : 'bool' , name : 'bool' , label : 'Boolean' , type : 'boolean' } as InputParam ,
295+ { id : 'arr' , name : 'arr' , label : 'Array' , type : 'array' } as InputParam
296+ ]
297+ }
298+
299+ render ( < ArrayInput inputParam = { inputParamWithTypes } data = { mockNodeData } onDataChange = { mockOnDataChange } /> )
300+
301+ fireEvent . click ( screen . getByRole ( 'button' , { name : / A d d T e s t I t e m / i } ) )
302+
303+ expect ( mockOnDataChange ) . toHaveBeenCalledWith ( {
304+ inputParam : inputParamWithTypes ,
305+ newValue : [ { str : '' , num : 0 , bool : false , arr : [ ] } ]
306+ } )
307+ } )
308+
309+ // Test 12: itemParameters prop overrides inputParam.array display flags
285310 it ( 'should use itemParameters prop for field visibility when provided, ignoring inputParam.array display flags' , ( ) => {
286311 // inputParam.array has both fields with no display flag (both would show)
287312 const dataWithItem : NodeData = {
0 commit comments