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

Commit 11695ca

Browse files
committed
fix($animateCss): make sure that skipBlocking avoids the pre-emptive transition-delay styling
1 parent cce084e commit 11695ca

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/ngAnimate/animateCss.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
624624
// transition delay to allow for the transition to naturally do it's thing. The beauty here is
625625
// that if there is no transition defined then nothing will happen and this will also allow
626626
// other transitions to be stacked on top of each other without any chopping them out.
627-
if (isFirst) {
627+
if (isFirst && !options.skipBlocking) {
628628
blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);
629629
}
630630

@@ -683,12 +683,13 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
683683
}
684684

685685
applyAnimationFromStyles(element, options);
686-
if (!flags.blockTransition) {
686+
687+
if (flags.blockTransition || flags.blockKeyframeAnimation) {
688+
applyBlocking(maxDuration);
689+
} else if (!options.skipBlocking) {
687690
blockTransitions(node, false);
688691
}
689692

690-
applyBlocking(maxDuration);
691-
692693
// TODO(matsko): for 1.5 change this code to have an animator object for better debugging
693694
return {
694695
$$willAnimate: true,

test/ngAnimate/animateCssSpec.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ describe("ngAnimate $animateCss", function() {
14231423
they('should not place a CSS transition block if options.skipBlocking is provided',
14241424
['enter', 'leave', 'move', 'addClass', 'removeClass'], function(event) {
14251425

1426-
inject(function($animateCss, $rootElement, $$body) {
1426+
inject(function($animateCss, $rootElement, $$body, $window) {
14271427
var element = jqLite('<div></div>');
14281428
$rootElement.append(element);
14291429
$$body.append($rootElement);
@@ -1441,14 +1441,23 @@ describe("ngAnimate $animateCss", function() {
14411441
data.event = event;
14421442
}
14431443

1444+
var blockSpy = spyOn($window, 'blockTransitions').andCallThrough();
1445+
14441446
data.skipBlocking = true;
14451447
var animator = $animateCss(element, data);
14461448

1449+
expect(blockSpy).not.toHaveBeenCalled();
1450+
14471451
expect(element.attr('style')).toBeFalsy();
14481452
animator.start();
14491453
triggerAnimationStartFrame();
14501454

14511455
expect(element.attr('style')).toBeFalsy();
1456+
1457+
// just to prove it works
1458+
data.skipBlocking = false;
1459+
var animator = $animateCss(element, { addClass: 'test' });
1460+
expect(blockSpy).toHaveBeenCalled();
14521461
});
14531462
});
14541463

0 commit comments

Comments
 (0)