From 99720fb5ab7259af37f708bc4eeda7cbbe790a69 Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Mon, 24 Feb 2014 14:47:12 -0500 Subject: fix($animate): ensure all animated elements are taken care of during the closing timeout Closes #6395 --- test/ngAnimate/animateSpec.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'test') diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index 47e7afff..27eeb112 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -1181,6 +1181,49 @@ describe("ngAnimate", function() { expect(element.hasClass('some-class-add-active')).toBe(false); })); + it("should intelligently cancel former timeouts and close off a series of elements a final timeout", function() { + var cancellations = 0; + module(function($provide) { + $provide.decorator('$timeout', function($delegate) { + var _cancel = $delegate.cancel; + $delegate.cancel = function() { + cancellations++; + return _cancel.apply($delegate, arguments); + }; + return $delegate; + }); + }) + inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { + if (!$sniffer.transitions) return; + + ss.addRule('.animate-me', '-webkit-transition:1s linear all;' + + 'transition:1s linear all;'); + + element = $compile(html('