File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,12 @@ export default class Form extends Component {
139139 return  formData ; 
140140 } 
141141
142-  return  _pick ( formData ,  fields ) ; 
142+  let  data  =  _pick ( formData ,  fields ) ; 
143+  if  ( Array . isArray ( formData ) )  { 
144+  return  Object . keys ( data ) . map ( key  =>  data [ key ] ) ; 
145+  } 
146+ 
147+  return  data ; 
143148 } ; 
144149
145150 getFieldNames  =  ( pathSchema ,  formData )  =>  { 
Original file line number Diff line number Diff line change @@ -866,6 +866,25 @@ describe("Form", () => {
866866 expect ( result ) . eql ( "foo" ) ; 
867867 } ) ; 
868868
869+  it ( "should return the root level array" ,  ( )  =>  { 
870+  const  schema  =  { 
871+  type : "array" , 
872+  items : { 
873+  type : "string" , 
874+  } , 
875+  } ; 
876+  const  formData  =  [ ] ; 
877+  const  onSubmit  =  sandbox . spy ( ) ; 
878+  const  {  comp }  =  createFormComponent ( { 
879+  schema, 
880+  formData, 
881+  onSubmit, 
882+  } ) ; 
883+ 
884+  const  result  =  comp . getUsedFormData ( formData ,  [ ] ) ; 
885+  expect ( result ) . eql ( [ ] ) ; 
886+  } ) ; 
887+ 
869888 it ( "should call getUsedFormData with data from fields in event" ,  ( )  =>  { 
870889 const  schema  =  { 
871890 type : "object" , 
                         You can’t perform that action at this time. 
           
                  
0 commit comments