@@ -568,39 +568,39 @@ describe('schema-form.provider.js', function() {
568
568
} ) ;
569
569
} ) ;
570
570
571
- it ( 'regression test for merging schema that defines an array of objects #900' , function ( ) {
572
- inject ( function ( schemaForm ) {
573
-
574
- var arrayObjectSchema = {
571
+ var arrayObjectSchema = {
572
+ type : "object" ,
573
+ properties : {
574
+ peopleLivingWithYou : {
575
575
type : "object" ,
576
576
properties : {
577
- peopleLivingWithYou : {
578
- type : "object" ,
579
- properties : {
580
- dependentChildren : {
581
- type : "array" ,
582
- minItems : 1 ,
583
- items : {
584
- type : "object" ,
585
- properties : {
586
- name : {
587
- title : "Name" ,
588
- type : "string"
589
- } ,
590
- age : {
591
- title : "Age" ,
592
- type : "integer"
593
- }
594
- } ,
595
- required : [ "name" ]
577
+ dependentChildren : {
578
+ type : "array" ,
579
+ minItems : 1 ,
580
+ items : {
581
+ type : "object" ,
582
+ properties : {
583
+ name : {
584
+ title : "Name" ,
585
+ type : "string"
586
+ } ,
587
+ age : {
588
+ title : "Age" ,
589
+ type : "integer"
596
590
}
597
- }
598
- } ,
599
- required : [ "dependentChildren" ]
591
+ } ,
592
+ required : [ "name" ]
593
+ }
600
594
}
601
595
} ,
602
- required : [ "peopleLivingWithYou" ]
603
- } ;
596
+ required : [ "dependentChildren" ]
597
+ }
598
+ } ,
599
+ required : [ "peopleLivingWithYou" ]
600
+ } ;
601
+
602
+ it ( 'merge a schema that defines an array of objects with a form inside a section #900' , function ( ) {
603
+ inject ( function ( schemaForm ) {
604
604
605
605
var formInsideSection = [ {
606
606
type : 'section' ,
@@ -621,5 +621,25 @@ describe('schema-form.provider.js', function() {
621
621
ageKey . join ( '.' ) . should . eq ( "peopleLivingWithYou.dependentChildren..age" ) ;
622
622
} ) ;
623
623
} ) ;
624
+
625
+ it ( 'merge a schema that defines an array of objects with a form without a section #900' , function ( ) {
626
+ inject ( function ( schemaForm ) {
627
+
628
+ var formWithoutSection = [ {
629
+ key : 'peopleLivingWithYou.dependentChildren' ,
630
+ add : "Add Child" ,
631
+ title : 'Dependent children details' ,
632
+ validationMessage : 'Complete all required fields for at least one child'
633
+ } ] ;
634
+
635
+ var merged = schemaForm . merge ( arrayObjectSchema , formWithoutSection ) ;
636
+ var objectPropertyKeys = merged [ 0 ] . items [ 0 ] ;
637
+ var nameKey = objectPropertyKeys . items [ 0 ] . key ;
638
+ var ageKey = objectPropertyKeys . items [ 1 ] . key ;
639
+
640
+ nameKey . join ( '.' ) . should . eq ( "peopleLivingWithYou.dependentChildren..name" ) ;
641
+ ageKey . join ( '.' ) . should . eq ( "peopleLivingWithYou.dependentChildren..age" ) ;
642
+ } ) ;
643
+ } ) ;
624
644
} ) ;
625
645
} ) ;
0 commit comments