@@ -28,20 +28,27 @@ describe("$animator", function() {
2828 } ) ;
2929 } ) ;
3030
31- it ( "should disable and enable the animations" , inject ( function ( $animator , $rootScope , $window ) {
32- expect ( $animator . enabled ( ) ) . toBe ( false ) ;
31+ it ( "should disable and enable the animations" , function ( ) {
32+ var initialState = null ;
33+ var animator ;
3334
34- $rootScope . $digest ( ) ;
35- $window . setTimeout . expect ( 0 ) . process ( ) ;
35+ angular . bootstrap ( body , [ function ( ) {
36+ return function ( $animator ) {
37+ animator = $animator ;
38+ initialState = $animator . enabled ( ) ;
39+ }
40+ } ] ) ;
3641
37- expect ( $animator . enabled ( ) ) . toBe ( true ) ;
42+ expect ( initialState ) . toBe ( false ) ;
3843
39- expect ( $animator . enabled ( 0 ) ) . toBe ( false ) ;
40- expect ( $animator . enabled ( ) ) . toBe ( false ) ;
44+ expect ( animator . enabled ( ) ) . toBe ( true ) ;
4145
42- expect ( $animator . enabled ( 1 ) ) . toBe ( true ) ;
43- expect ( $animator . enabled ( ) ) . toBe ( true ) ;
44- } ) ) ;
46+ expect ( animator . enabled ( 0 ) ) . toBe ( false ) ;
47+ expect ( animator . enabled ( ) ) . toBe ( false ) ;
48+
49+ expect ( animator . enabled ( 1 ) ) . toBe ( true ) ;
50+ expect ( animator . enabled ( ) ) . toBe ( true ) ;
51+ } ) ;
4552
4653 } ) ;
4754
@@ -145,9 +152,6 @@ describe("$animator", function() {
145152 ngAnimate : '{enter: \'custom\'}'
146153 } ) ;
147154
148- $rootScope . $digest ( ) ; // re-enable the animations;
149- window . setTimeout . expect ( 0 ) . process ( ) ;
150-
151155 expect ( element . contents ( ) . length ) . toBe ( 0 ) ;
152156 animator . enter ( child , element ) ;
153157 window . setTimeout . expect ( 1 ) . process ( ) ;
@@ -158,9 +162,6 @@ describe("$animator", function() {
158162 ngAnimate : '{leave: \'custom\'}'
159163 } ) ;
160164
161- $rootScope . $digest ( ) ; // re-enable the animations;
162- window . setTimeout . expect ( 0 ) . process ( ) ;
163-
164165 element . append ( child ) ;
165166 expect ( element . contents ( ) . length ) . toBe ( 1 ) ;
166167 animator . leave ( child , element ) ;
0 commit comments