File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments