@@ -28,20 +28,27 @@ describe("$animator", function() {
28
28
} ) ;
29
29
} ) ;
30
30
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 ;
33
34
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
+ } ] ) ;
36
41
37
- expect ( $animator . enabled ( ) ) . toBe ( true ) ;
42
+ expect ( initialState ) . toBe ( false ) ;
38
43
39
- expect ( $animator . enabled ( 0 ) ) . toBe ( false ) ;
40
- expect ( $animator . enabled ( ) ) . toBe ( false ) ;
44
+ expect ( animator . enabled ( ) ) . toBe ( true ) ;
41
45
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
+ } ) ;
45
52
46
53
} ) ;
47
54
@@ -145,9 +152,6 @@ describe("$animator", function() {
145
152
ngAnimate : '{enter: \'custom\'}'
146
153
} ) ;
147
154
148
- $rootScope . $digest ( ) ; // re-enable the animations;
149
- window . setTimeout . expect ( 0 ) . process ( ) ;
150
-
151
155
expect ( element . contents ( ) . length ) . toBe ( 0 ) ;
152
156
animator . enter ( child , element ) ;
153
157
window . setTimeout . expect ( 1 ) . process ( ) ;
@@ -158,9 +162,6 @@ describe("$animator", function() {
158
162
ngAnimate : '{leave: \'custom\'}'
159
163
} ) ;
160
164
161
- $rootScope . $digest ( ) ; // re-enable the animations;
162
- window . setTimeout . expect ( 0 ) . process ( ) ;
163
-
164
165
element . append ( child ) ;
165
166
expect ( element . contents ( ) . length ) . toBe ( 1 ) ;
166
167
animator . leave ( child , element ) ;
0 commit comments