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

Commit 0a75a3d

Browse files
sreeramumatsko
authored andcommitted
fix($animateCss): ensure failed animations clear the internal cache
Closes #12214 Closes #12518 Closes #12381
1 parent b643f0d commit 0a75a3d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/ngAnimate/animateCss.js

+2
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
724724
cancel: cancelFn
725725
});
726726

727+
// should flush the cache animation
728+
waitUntilQuiet(noop);
727729
close();
728730

729731
return {

test/ngAnimate/animateCssSpec.js

+19
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,25 @@ describe("ngAnimate $animateCss", function() {
12771277
expect(element.attr('style')).not.toContain('transition');
12781278
}));
12791279

1280+
it("should clear cache if no animation so follow-up animation on the same element will not be from cache",
1281+
inject(function($animateCss, $rootElement, $$body, $$rAF) {
1282+
var element = jqLite('<div class="rclass"></div>');
1283+
var options = {
1284+
event: 'enter',
1285+
structural: true
1286+
};
1287+
$rootElement.append(element);
1288+
$$body.append($rootElement);
1289+
var animator = $animateCss(element, options);
1290+
expect(animator.$$willAnimate).toBeFalsy();
1291+
1292+
$$rAF.flush();
1293+
ss.addRule('.ng-enter', '-webkit-animation:3.5s keyframe_animation;' +
1294+
'animation:3.5s keyframe_animation;');
1295+
animator = $animateCss(element, options);
1296+
expect(animator.$$willAnimate).toBeTruthy();
1297+
}));
1298+
12801299
it('should apply a custom temporary class when a non-structural animation is used',
12811300
inject(function($animateCss, $rootElement, $$body) {
12821301

0 commit comments

Comments
 (0)