fix($animate): ensure that parallel class-based animations are all eventually closed

When multiple classes are added/removed in parallel then $animate only closes off the
last animation when the fallback timer has expired. Now all animations are closed off.

Fixes #7766
This commit is contained in:
Matias Niemelä
2014-06-10 01:00:34 -04:00
parent b0ca5195e8
commit f07af61f05
2 changed files with 33 additions and 4 deletions

View File

@@ -1702,6 +1702,32 @@ describe("ngAnimate", function() {
});
});
it('should apply a closing timeout to close all parallel class-based animations on the same element',
inject(function($sniffer, $compile, $rootScope, $rootElement, $animate, $timeout) {
if (!$sniffer.transitions) return;
ss.addRule('.base-class', '-webkit-transition:2s linear all;' +
'transition:2s linear all;');
var element = $compile('<div class="base-class"></div>')($rootScope);
$rootElement.append(element);
jqLite($document[0].body).append($rootElement);
$animate.addClass(element, 'one');
$animate.addClass(element, 'two');
$animate.triggerReflow();
$timeout.flush(3000); //2s * 1.5
expect(element.hasClass('one-add')).toBeFalsy();
expect(element.hasClass('one-add-active')).toBeFalsy();
expect(element.hasClass('two-add')).toBeFalsy();
expect(element.hasClass('two-add-active')).toBeFalsy();
expect(element.hasClass('ng-animate')).toBeFalsy();
}));
it("apply a closing timeout with respect to a staggering animation",
inject(function($animate, $rootScope, $compile, $sniffer, $timeout) {