File tree Expand file tree Collapse file tree 1 file changed +57
-1
lines changed Expand file tree Collapse file tree 1 file changed +57
-1
lines changed Original file line number Diff line number Diff line change @@ -592,8 +592,64 @@ describe('directive',function(){
592592
593593 } ) ;
594594 } ) ;
595+
596+ it ( 'should handle schema form default in deep structure' , function ( ) {
597+
598+ inject ( function ( $compile , $rootScope ) {
599+ var scope = $rootScope . $new ( ) ;
600+ scope . person = {
601+ name : 'Foobar'
602+ } ;
603+
604+ scope . schema = {
605+ "type" : "object" ,
606+ "properties" : {
607+ "props" : {
608+ "type" : "object" ,
609+ "title" : "Person" ,
610+ "properties" : {
611+ "name" : {
612+ "type" : "string" ,
613+ "default" : "Name"
614+ } ,
615+ "nick" : {
616+ "type" : "string" ,
617+ "default" : "Nick"
618+ } ,
619+ "alias" : {
620+ "type" : "string"
621+ }
622+ }
623+ }
624+ }
625+ } ;
626+
627+ //The form defines a fieldset for person, and changes the order of fields
628+ //but titles should come from the schema
629+ scope . form = [ {
630+ type : 'fieldset' ,
631+ key : 'props' ,
632+ items : [
633+ 'props.nick' ,
634+ 'props.name' ,
635+ 'props.alias'
636+ ]
637+ } ] ;
638+
639+ var tmpl = angular . element ( '<form sf-schema="schema" sf-form="form" sf-model="person"></form>' ) ;
640+
641+ $compile ( tmpl ) ( scope ) ;
642+ $rootScope . $apply ( ) ;
643+
644+ scope . person . props . name . should . be . equal ( 'Name' ) ;
645+ scope . person . props . nick . should . be . equal ( 'Nick' ) ;
646+ expect ( scope . person . props . alias ) . to . be . undefined ;
647+
648+ } ) ;
649+ } ) ;
650+
595651
596- it ( 'should handle schema form defaults in deep structure' , function ( ) {
652+ it ( 'should handle schema form titles in deep structure' , function ( ) {
597653
598654 inject ( function ( $compile , $rootScope ) {
599655 var scope = $rootScope . $new ( ) ;
You can’t perform that action at this time.
0 commit comments