aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngAnimate/animateSpec.js
diff options
context:
space:
mode:
authorMatias Niemelä2013-10-28 10:43:41 -0600
committerMatias Niemelä2013-10-28 14:26:07 -0700
commit6818542c694aec6c811fb2fe2f86f7d16544c39b (patch)
tree74088780d34d9abb452294e36fba27e9c442cba3 /test/ngAnimate/animateSpec.js
parent74848307443c00ab07552336c56ddfa1e9ef6eff (diff)
downloadangular.js-6818542c694aec6c811fb2fe2f86f7d16544c39b.tar.bz2
fix($animate): ensure enable/disable animations work when the document node is used
Closes #4669
Diffstat (limited to 'test/ngAnimate/animateSpec.js')
-rw-r--r--test/ngAnimate/animateSpec.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index 7bd9fc85..c995cd83 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -120,6 +120,46 @@ describe("ngAnimate", function() {
expect(count).toBe(0);
});
});
+
+ it('should check enable/disable animations up until the $rootElement element', function() {
+ var rootElm = jqLite('<div></div>');
+
+ var captured = false;
+ module(function($provide, $animateProvider) {
+ $provide.value('$rootElement', rootElm);
+ $animateProvider.register('.ani', function() {
+ return {
+ addClass : function(element, className, done) {
+ captured = true;
+ done();
+ }
+ }
+ });
+ });
+ inject(function($animate, $rootElement, $rootScope, $compile, $timeout) {
+ var initialState;
+ angular.bootstrap(rootElm, ['ngAnimate']);
+
+ $animate.enabled(true);
+
+ var element = $compile('<div class="ani"></div>')($rootScope);
+ rootElm.append(element);
+
+ expect(captured).toBe(false);
+ $animate.addClass(element, 'red');
+ expect(captured).toBe(true);
+
+ captured = false;
+ $animate.enabled(false);
+
+ $animate.addClass(element, 'blue');
+ expect(captured).toBe(false);
+
+ //clean up the mess
+ $animate.enabled(false, rootElm);
+ dealoc(rootElm);
+ });
+ });
});
describe("with polyfill", function() {