@@ -50,4 +50,30 @@ describe('schemaFormDecorators', function() {
50
50
} ) ;
51
51
} ) ;
52
52
} ) ;
53
+
54
+ describe ( '#legacy #defineDecoratorWithRawTemplate' , function ( ) {
55
+ it ( 'should enable you to create new decorator directives' , function ( ) {
56
+ module ( function ( schemaFormDecoratorsProvider ) {
57
+ schemaFormDecoratorsProvider . defineDecorator ( 'foobar' , {
58
+ 'foo' : { template : '<div class="yes">YES</div>' , replace : true , type : 'template' }
59
+ } , [ angular . noop ] ) ;
60
+ } ) ;
61
+
62
+ inject ( function ( $rootScope , $compile ) {
63
+
64
+ //Since our directive does a replace we need a wrapper to actually check the content.
65
+ var templateWithWrap = angular . element ( '<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>' ) ;
66
+ var template = templateWithWrap . children ( ) . eq ( 0 ) ;
67
+
68
+ $compile ( template ) ( $rootScope ) ;
69
+ $rootScope . $apply ( ) ;
70
+ templateWithWrap . children ( ) . length . should . equal ( 1 ) ;
71
+ templateWithWrap . children ( ) . is ( 'foobar' ) . should . be . true ;
72
+ templateWithWrap . children ( ) . eq ( 0 ) . children ( ) . length . should . equal ( 1 ) ;
73
+ templateWithWrap . children ( ) . eq ( 0 ) . children ( ) . is ( 'div' ) . should . be . true ;
74
+ templateWithWrap . children ( ) . eq ( 0 ) . children ( ) . hasClass ( 'yes' ) . should . be . true ;
75
+ } ) ;
76
+ } ) ;
77
+ } ) ;
78
+
53
79
} ) ;
0 commit comments