Skip to content

Commit 87fdf99

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

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
@@ -616,7 +616,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
616616
// transition delay to allow for the transition to naturally do it's thing. The beauty here is
617617
// that if there is no transition defined then nothing will happen and this will also allow
618618
// other transitions to be stacked on top of each other without any chopping them out.
619-
if (isFirst) {
619+
if (isFirst && !options.skipBlocking) {
620620
blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);
621621
}
622622

@@ -675,12 +675,13 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
675675
}
676676

677677
applyAnimationFromStyles(element, options);
678-
if (!flags.blockTransition) {
678+
679+
if (flags.blockTransition || flags.blockKeyframeAnimation) {
680+
applyBlocking(maxDuration);
681+
} else if (!options.skipBlocking) {
679682
blockTransitions(node, false);
680683
}
681684

682-
applyBlocking(maxDuration);
683-
684685
// TODO(matsko): for 1.5 change this code to have an animator object for better debugging
685686
return {
686687
$$willAnimate: true,

test/ngAnimate/animateCssSpec.js

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

1389-
inject(function($animateCss, $rootElement, $document) {
1389+
inject(function($animateCss, $rootElement, $document, $sniffer, $window) {
13901390
var element = jqLite('<div></div>');
13911391
$rootElement.append(element);
13921392
jqLite($document[0].body).append($rootElement);
@@ -1404,14 +1404,23 @@ describe("ngAnimate $animateCss", function() {
14041404
data.event = event;
14051405
}
14061406

1407+
var blockSpy = spyOn($window, 'blockTransitions').andCallThrough();
1408+
14071409
data.skipBlocking = true;
14081410
var animator = $animateCss(element, data);
14091411

1412+
expect(blockSpy).not.toHaveBeenCalled();
1413+
14101414
expect(element.attr('style')).toBeFalsy();
14111415
animator.start();
14121416
triggerAnimationStartFrame();
14131417

14141418
expect(element.attr('style')).toBeFalsy();
1419+
1420+
// just to prove it works
1421+
data.skipBlocking = false;
1422+
var animator = $animateCss(element, { addClass: 'test' });
1423+
expect(blockSpy).toHaveBeenCalled();
14151424
});
14161425
});
14171426

0 commit comments

Comments
 (0)