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

Commit 6dd64ab

Browse files
committed
fix(ngAnimate): ensure that a filtered-out leave animation always runs its DOM operation
This patch fixes the issue where filtered-out leave animations were not properly run the DOM operation when closed. Closes #11555
1 parent 3af93a5 commit 6dd64ab

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/ngAnimate/animateQueue.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
250250

251251
var className = [node.className, options.addClass, options.removeClass].join(' ');
252252
if (!isAnimatableClassName(className)) {
253-
runner.end();
253+
close();
254254
return runner;
255255
}
256256

test/ngAnimate/animateSpec.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ describe("animations", function() {
133133
module(function($animateProvider) {
134134
$animateProvider.classNameFilter(/only-allow-this-animation/);
135135
});
136-
inject(function($animate, $rootScope, $document, $rootElement) {
136+
inject(function($animate, $rootScope) {
137137
expect(element).not.toHaveClass('only-allow-this-animation');
138138

139139
$animate.enter(element, parent);
@@ -148,6 +148,22 @@ describe("animations", function() {
148148
});
149149
});
150150

151+
it('should complete the leave DOM operation in case the classNameFilter fails', function() {
152+
module(function($animateProvider) {
153+
$animateProvider.classNameFilter(/memorable-animation/);
154+
});
155+
inject(function($animate, $rootScope) {
156+
expect(element).not.toHaveClass('memorable-animation');
157+
158+
parent.append(element);
159+
$animate.leave(element);
160+
$rootScope.$digest();
161+
162+
expect(capturedAnimation).toBeFalsy();
163+
expect(element[0].parentNode).toBeFalsy();
164+
});
165+
});
166+
151167
describe('enabled()', function() {
152168
it("should work for all animations", inject(function($animate) {
153169

0 commit comments

Comments
 (0)