Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($animate): ensure that animations are not disabled after $rootElement is animated #3892

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ngAnimate/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,9 @@ angular.module('ngAnimate', ['ng'])
function done() {
if(!done.hasBeenRun) {
done.hasBeenRun = true;
element.removeData(NG_ANIMATE_STATE);
if(element != $rootElement) {
element.removeData(NG_ANIMATE_STATE);
}
(onComplete || noop)();
}
}
Expand Down
17 changes: 17 additions & 0 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1515,4 +1515,21 @@ describe("ngAnimate", function() {
});
});

it("should not remove the animation flag data on $rootElement after an animation is executed",
inject(function($compile, $rootElement, $animate, $document) {

var stateFlag = '$$ngAnimateState';
var body = jqLite($document[0].body);

//this is here since $rootElement is not on the document node
body.data(stateFlag, {});
body.append($rootElement);

expect(isObject($rootElement.data(stateFlag))).toBe(true);

$animate.addClass($rootElement, 'parent');

expect(isObject($rootElement.data(stateFlag))).toBe(true);
}));

});