diff --git a/src/ngAnimate/animateQueue.js b/src/ngAnimate/animateQueue.js index 04f837c8aaa9..a9b2c8384d13 100644 --- a/src/ngAnimate/animateQueue.js +++ b/src/ngAnimate/animateQueue.js @@ -507,15 +507,15 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) { forEach(children, function(child) { var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME)); var animationDetails = activeAnimationsLookup.get(child); - switch (state) { - case RUNNING_STATE: - animationDetails.runner.end(); - /* falls through */ - case PRE_DIGEST_STATE: - if (animationDetails) { + if (animationDetails) { + switch (state) { + case RUNNING_STATE: + animationDetails.runner.end(); + /* falls through */ + case PRE_DIGEST_STATE: activeAnimationsLookup.remove(child); + break; } - break; } }); } diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index 9df3b400bdc3..aebe41c963ea 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -850,6 +850,26 @@ describe("animations", function() { expect(isCancelled).toBe(true); })); + it('should ignore an apparently ongoing post-digest child animation that has no animation data', + inject(function($rootScope, $rootElement, $animate) { + + parent.append(element); + + $animate.addClass(element, 'rumlow'); + + $rootScope.$digest(); + expect(capturedAnimation[0]).toBe(element); + + // If an element is cloned during an animation, it still has the data-attributes indicating + // an animation + var clone = element.clone(); + parent.append(clone); + + $animate.move(parent, null, parent2); + $rootScope.$digest(); + expect(capturedAnimation[0]).toBe(parent); + })); + it('should not end any child animations if a parent class-based animation is issued', inject(function($rootScope, $rootElement, $animate) {