mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
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:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user