From 7c605ddf1c57c9f162827713ca5b0fbb12de5fa5 Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Thu, 22 Aug 2013 09:30:11 -0400 Subject: fix($animate): skip ngAnimate animations if the provided element already has transitions/durations attached to it Closes #3587 --- test/ngAnimate/animateSpec.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index 2d9d25af..75029889 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -1584,4 +1584,33 @@ describe("ngAnimate", function() { }); }); + it("should skip ngAnimate animations when any pre-existing CSS transitions are present on the element", function() { + inject(function($compile, $rootScope, $animate, $timeout, $sniffer) { + if(!$sniffer.transitions) return; + + var element = html($compile('
')($rootScope)); + var child = html($compile('')($rootScope)); + + ss.addRule('.animated', 'transition:1s linear all;' + + vendorPrefix + 'transition:1s linear all'); + ss.addRule('.super-add', 'transition:2s linear all;' + + vendorPrefix + 'transition:2s linear all'); + + $rootElement.append(element); + jqLite(document.body).append($rootElement); + + $animate.addClass(element, 'super'); + $timeout.flush(0); + + var empty = true; + try { + $timeout.flush(); + empty = false; + } + catch(e) {} + + expect(empty).toBe(true); + }); + }); + }); -- cgit v1.2.3