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 21:26:35 -0700
commit7f0767acaba1ec3c8849244a604b0d1c8c376446 (patch)
tree8c9ff0aaabf342c13aea87e158ddb699d255b345 /test/ngAnimate/animateSpec.js
parent3d4c80cc3e8b1c3f673507ef252e872c374ba431 (diff)
downloadangular.js-7f0767acaba1ec3c8849244a604b0d1c8c376446.tar.bz2
fix($animate): ensure former nodes are fully cleaned up when a follow-up structural animation takes place
Closes #4435
Diffstat (limited to 'test/ngAnimate/animateSpec.js')
-rw-r--r--test/ngAnimate/animateSpec.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index c995cd83..bc0d3347 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -1817,6 +1817,42 @@ describe("ngAnimate", function() {
// expect(element.hasClass('hiding')).toBe(false);
// });
// });
+ it("should remove all the previous classes when the next animation is applied before a reflow", function() {
+ var fn, interceptedClass;
+ module(function($animateProvider) {
+ $animateProvider.register('.three', function() {
+ return {
+ move : function(element, done) {
+ fn = function() {
+ done();
+ }
+ return function() {
+ interceptedClass = element.attr('class');
+ }
+ }
+ }
+ });
+ });
+ inject(function($compile, $rootScope, $animate, $timeout) {
+ var parent = html($compile('<div class="parent"></div>')($rootScope));
+ var one = $compile('<div class="one"></div>')($rootScope);
+ var two = $compile('<div class="two"></div>')($rootScope);
+ var three = $compile('<div class="three klass"></div>')($rootScope);
+
+ parent.append(one);
+ parent.append(two);
+ parent.append(three);
+
+ $animate.move(three, null, two);
+ $rootScope.$digest();
+
+ $animate.move(three, null, one);
+ $rootScope.$digest();
+
+ //this means that the former animation was cleaned up before the new one starts
+ expect(interceptedClass.indexOf('ng-animate') >= 0).toBe(false);
+ });
+ });
it("should provide the correct CSS class to the addClass and removeClass callbacks within a JS animation", function() {
module(function($animateProvider) {