@@ -16,6 +16,30 @@ describe('schemaFormDecorators', function() {
16
16
var templateWithWrap = angular . element ( '<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>' ) ;
17
17
var template = templateWithWrap . children ( ) . eq ( 0 ) ;
18
18
19
+ $compile ( template ) ( $rootScope ) ;
20
+ $rootScope . $apply ( ) ;
21
+ templateWithWrap . children ( ) . length . should . equal ( 1 ) ;
22
+ templateWithWrap . children ( ) . is ( 'foobar' ) . should . be . true ;
23
+ templateWithWrap . children ( ) . eq ( 0 ) . children ( ) . length . should . equal ( 1 ) ;
24
+ templateWithWrap . children ( ) . eq ( 0 ) . children ( ) . is ( 'div' ) . should . be . true ;
25
+ templateWithWrap . children ( ) . eq ( 0 ) . children ( ) . hasClass ( 'yes' ) . should . be . true ;
26
+ } ) ;
27
+ } ) ;
28
+ } ) ;
29
+ describe ( '#createDecoratorWithRawTemplate' , function ( ) {
30
+ it ( 'should enable you to create new decorator directives' , function ( ) {
31
+ module ( function ( schemaFormDecoratorsProvider ) {
32
+ schemaFormDecoratorsProvider . defineDecorator ( 'foobar' , {
33
+ 'foo' : { template : '<div class="yes">YES</div>' , replace : true , type : 'template' }
34
+ } , [ angular . noop ] ) ;
35
+ } ) ;
36
+
37
+ inject ( function ( $rootScope , $compile ) {
38
+
39
+ //Since our directive does a replace we need a wrapper to actually check the content.
40
+ var templateWithWrap = angular . element ( '<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>' ) ;
41
+ var template = templateWithWrap . children ( ) . eq ( 0 ) ;
42
+
19
43
$compile ( template ) ( $rootScope ) ;
20
44
$rootScope . $apply ( ) ;
21
45
templateWithWrap . children ( ) . length . should . equal ( 1 ) ;
0 commit comments