Skip to content

Commit 271c896

Browse files
committed
Merge branch 'Sandreu-test-description' into development
2 parents 3d5d848 + ba57815 commit 271c896

File tree

1 file changed

+57
-1
lines changed

1 file changed

+57
-1
lines changed

test/directives/schema-form-test.js

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)