11chai . should ( ) ;
22
3- describe ( 'decorator factory service' , function ( ) {
4- beforeEach ( module ( 'templates' ) ) ;
3+ describe ( 'schemaFormDecorators' , function ( ) {
54 beforeEach ( module ( 'schemaForm' ) ) ;
65
7- it ( 'should enable you to create new decorator directives' , function ( ) {
8- module ( function ( schemaFormDecoratorsProvider ) {
9- schemaFormDecoratorsProvider . createDecorator ( 'foobar' , { 'foo' :'/bar.html' } , [ angular . noop ] ) ;
10- } ) ;
11-
12- inject ( function ( $rootScope , $compile , $templateCache ) {
13- $templateCache . put ( '/bar.html' , '<div class="yes">YES</div>' ) ;
6+ describe ( '#createDecorator' , function ( ) {
7+ it ( 'should enable you to create new decorator directives' , function ( ) {
8+ module ( function ( schemaFormDecoratorsProvider ) {
9+ schemaFormDecoratorsProvider . createDecorator ( 'foobar' , { 'foo' :'/bar.html' } , [ angular . noop ] ) ;
10+ } ) ;
1411
15- //Since our directive does a replace we need a wrapper to actually check the content.
16- var templateWithWrap = angular . element ( '<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>' ) ;
17- var template = templateWithWrap . children ( ) . eq ( 0 ) ;
12+ inject ( function ( $rootScope , $compile , $templateCache ) {
13+ $templateCache . put ( '/bar.html' , '<div class="yes">YES</div>' ) ;
1814
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 ;
15+ //Since our directive does a replace we need a wrapper to actually check the content.
16+ var templateWithWrap = angular . element ( '<div id="wrap"><foobar form="{ type: \'foo\'}"></foobar></div>' ) ;
17+ var template = templateWithWrap . children ( ) . eq ( 0 ) ;
2618
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+ } ) ;
2727 } ) ;
2828 } ) ;
29- } ) ;
29+ } ) ;
0 commit comments