Navigation Menu

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

Commit

Permalink
fix(ngAnimate): ensure that a filtered-out leave animation always run…
Browse files Browse the repository at this point in the history
…s its DOM operation

This patch fixes the issue where filtered-out leave animations were not
properly run the DOM operation when closed.

Closes #11555
  • Loading branch information
matsko committed Apr 15, 2015
1 parent 3af93a5 commit 6dd64ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ngAnimate/animateQueue.js
Expand Up @@ -250,7 +250,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {

var className = [node.className, options.addClass, options.removeClass].join(' ');
if (!isAnimatableClassName(className)) {
runner.end();
close();
return runner;
}

Expand Down
18 changes: 17 additions & 1 deletion test/ngAnimate/animateSpec.js
Expand Up @@ -133,7 +133,7 @@ describe("animations", function() {
module(function($animateProvider) {
$animateProvider.classNameFilter(/only-allow-this-animation/);
});
inject(function($animate, $rootScope, $document, $rootElement) {
inject(function($animate, $rootScope) {
expect(element).not.toHaveClass('only-allow-this-animation');

$animate.enter(element, parent);
Expand All @@ -148,6 +148,22 @@ describe("animations", function() {
});
});

it('should complete the leave DOM operation in case the classNameFilter fails', function() {
module(function($animateProvider) {
$animateProvider.classNameFilter(/memorable-animation/);
});
inject(function($animate, $rootScope) {
expect(element).not.toHaveClass('memorable-animation');

parent.append(element);
$animate.leave(element);
$rootScope.$digest();

expect(capturedAnimation).toBeFalsy();
expect(element[0].parentNode).toBeFalsy();
});
});

describe('enabled()', function() {
it("should work for all animations", inject(function($animate) {

Expand Down

0 comments on commit 6dd64ab

Please sign in to comment.