aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngAnimate/animateSpec.js
diff options
context:
space:
mode:
authorMatias Niemelä2013-11-18 16:20:22 -0500
committerMatias Niemelä2013-11-21 20:48:07 -0500
commit062fbed8fc3f7bc55433f8c6915c27520e6f63c5 (patch)
treec8c376acfdf2629fa18369a747a1ea88d920df71 /test/ngAnimate/animateSpec.js
parent76e4db6f3d15199ac1fbe85f9cfa6079a1c4fa56 (diff)
downloadangular.js-062fbed8fc3f7bc55433f8c6915c27520e6f63c5.tar.bz2
fix($animate): ensure transition animations are unblocked before the dom operation occurs
Transitions are blocked when the base CSS class is added at the start of the animation. This causes an issue if the followup CSS class contains animatable-styles. Now, once the animation active state is triggered (when the animation CSS dom operation occurs) the animation itself will always trigger an animate without a quick jump. Closes #5014 Closes #4265
Diffstat (limited to 'test/ngAnimate/animateSpec.js')
-rw-r--r--test/ngAnimate/animateSpec.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index b9b7f9ed..2362576a 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -2663,4 +2663,37 @@ describe("ngAnimate", function() {
expect(element.hasClass('base-class')).toBe(true);
}));
+ it('should block and unblock transitions before the dom operation occurs',
+ inject(function($rootScope, $compile, $rootElement, $document, $animate, $sniffer, $timeout) {
+
+ if (!$sniffer.transitions) return;
+
+ $animate.enabled(true);
+
+ ss.addRule('.cross-animation', '-webkit-transition:1s linear all;' +
+ 'transition:1s linear all;');
+
+ var capturedProperty = 'none';
+
+ var element = $compile('<div class="cross-animation"></div>')($rootScope);
+ $rootElement.append(element);
+ jqLite($document[0].body).append($rootElement);
+
+ var node = element[0];
+ node._setAttribute = node.setAttribute;
+ node.setAttribute = function(prop, val) {
+ if(prop == 'class' && val.indexOf('trigger-class') >= 0) {
+ var propertyKey = ($sniffer.vendorPrefix == 'Webkit' ? '-webkit-' : '') + 'transition-property';
+ capturedProperty = element.css(propertyKey);
+ }
+ node._setAttribute(prop, val);
+ };
+
+ $animate.addClass(element, 'trigger-class');
+
+ $timeout.flush();
+
+ expect(capturedProperty).not.toBe('none');
+ }));
+
});