aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatias Niemelä2013-11-19 00:21:48 -0500
committerMatias Niemelä2013-11-21 20:48:15 -0500
commit6760d7a315d7ea5cbd4f8ab74b200f754a2041f4 (patch)
tree8e94b7e2e82f0b51ff4c436399e9bcf8adb73b86 /test
parent062fbed8fc3f7bc55433f8c6915c27520e6f63c5 (diff)
downloadangular.js-6760d7a315d7ea5cbd4f8ab74b200f754a2041f4.tar.bz2
fix($animate): ensure keyframe animations are blocked around the reflow
Keyframe animations trigger on the first CSS class and not the second. This may cause a slight flicker during a stagger animation since the animation has already started before the stagger delay is considered. This fix ensures that the animation is blocked until the active animation starts which allows for staggering animations to take over properly. Closes #5018
Diffstat (limited to 'test')
-rw-r--r--test/ngAnimate/animateSpec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index 2362576a..cbf9de63 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -2696,4 +2696,29 @@ describe("ngAnimate", function() {
expect(capturedProperty).not.toBe('none');
}));
+ it('should block and unblock keyframe animations around the reflow operation',
+ inject(function($rootScope, $compile, $rootElement, $document, $animate, $sniffer, $timeout) {
+
+ if (!$sniffer.animations) return;
+
+ $animate.enabled(true);
+
+ ss.addRule('.cross-animation', '-webkit-animation:1s my_animation;' +
+ 'animation:1s my_animation;');
+
+ var element = $compile('<div class="cross-animation"></div>')($rootScope);
+ $rootElement.append(element);
+ jqLite($document[0].body).append($rootElement);
+
+ var node = element[0];
+ var animationKey = $sniffer.vendorPrefix == 'Webkit' ? 'WebkitAnimation' : 'animation';
+
+ $animate.addClass(element, 'trigger-class');
+
+ expect(node.style[animationKey]).toContain('none');
+
+ $timeout.flush();
+
+ expect(node.style[animationKey]).not.toContain('none');
+ }));
});