@@ -120,6 +120,46 @@ describe("ngAnimate", function() {
120
120
expect ( count ) . toBe ( 0 ) ;
121
121
} ) ;
122
122
} ) ;
123
+
124
+ it ( 'should check enable/disable animations up until the $rootElement element' , function ( ) {
125
+ var rootElm = jqLite ( '<div></div>' ) ;
126
+
127
+ var captured = false ;
128
+ module ( function ( $provide , $animateProvider ) {
129
+ $provide . value ( '$rootElement' , rootElm ) ;
130
+ $animateProvider . register ( '.ani' , function ( ) {
131
+ return {
132
+ addClass : function ( element , className , done ) {
133
+ captured = true ;
134
+ done ( ) ;
135
+ }
136
+ }
137
+ } ) ;
138
+ } ) ;
139
+ inject ( function ( $animate , $rootElement , $rootScope , $compile , $timeout ) {
140
+ var initialState ;
141
+ angular . bootstrap ( rootElm , [ 'ngAnimate' ] ) ;
142
+
143
+ $animate . enabled ( true ) ;
144
+
145
+ var element = $compile ( '<div class="ani"></div>' ) ( $rootScope ) ;
146
+ rootElm . append ( element ) ;
147
+
148
+ expect ( captured ) . toBe ( false ) ;
149
+ $animate . addClass ( element , 'red' ) ;
150
+ expect ( captured ) . toBe ( true ) ;
151
+
152
+ captured = false ;
153
+ $animate . enabled ( false ) ;
154
+
155
+ $animate . addClass ( element , 'blue' ) ;
156
+ expect ( captured ) . toBe ( false ) ;
157
+
158
+ //clean up the mess
159
+ $animate . enabled ( false , rootElm ) ;
160
+ dealoc ( rootElm ) ;
161
+ } ) ;
162
+ } ) ;
123
163
} ) ;
124
164
125
165
describe ( "with polyfill" , function ( ) {
0 commit comments