Skip to content

Commit 8d33e14

Browse files
committed
Test for the decorator service
1 parent a9dedde commit 8d33e14

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/schema-form-test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,31 @@ describe('Schema form',function(){
773773
});
774774

775775
});
776+
777+
describe('decorator factory service',function(){
778+
it.only('should enable you to create new decorator directives',function(){
779+
module(function(schemaFormDecoratorsProvider){
780+
schemaFormDecoratorsProvider.create('foobar',{ 'foo':'/bar.html' },[angular.noop]);
781+
});
782+
783+
inject(function($rootScope,$compile,$templateCache){
784+
$templateCache.put('/bar.html','<div class="yes">YES</div>');
785+
786+
//Since our directive does a replace we need a wrapper to actually check the content.
787+
var templateWithWrap = angular.element('<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>');
788+
var template = templateWithWrap.children().eq(0);
789+
790+
$compile(template)($rootScope);
791+
$rootScope.$apply();
792+
templateWithWrap.children().length.should.equal(1);
793+
templateWithWrap.children().is('div').should.be.true;
794+
templateWithWrap.children().hasClass('yes').should.be.true;
795+
796+
});
797+
});
798+
});
799+
800+
776801
});
777802

778803

0 commit comments

Comments
 (0)