diff options
| author | Matias Niemelä | 2013-08-22 09:30:11 -0400 |
|---|---|---|
| committer | Misko Hevery | 2013-08-23 14:04:35 -0700 |
| commit | 7c605ddf1c57c9f162827713ca5b0fbb12de5fa5 (patch) | |
| tree | aa3dcaea4034ab00f2e8595154ff59a83681fddc /test | |
| parent | ee2f3d21da6c9fccfe1e6a4ea8a65627519c8bf2 (diff) | |
| download | angular.js-7c605ddf1c57c9f162827713ca5b0fbb12de5fa5.tar.bz2 | |
fix($animate): skip ngAnimate animations if the provided element already has transitions/durations attached to it
Closes #3587
Diffstat (limited to 'test')
| -rw-r--r-- | test/ngAnimate/animateSpec.js | 29 |
1 files changed, 29 insertions, 0 deletions
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('<div class="animated parent"></div>')($rootScope)); + var child = html($compile('<div class="animated child"></div>')($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); + }); + }); + }); |
