diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index 87e7620e..3ab5cc4c 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -1332,12 +1332,7 @@ describe("ngAnimate", function() { })); it("should intelligently cancel former timeouts and close off a series of elements a final timeout", function() { - var currentTimestamp = Date.now(); - spyOn(Date,'now').andCallFake(function() { - return currentTimestamp; - }); - - var cancellations = 0; + var currentTimestamp, cancellations = 0; module(function($provide) { $provide.decorator('$timeout', function($delegate) { var _cancel = $delegate.cancel; @@ -1349,6 +1344,15 @@ describe("ngAnimate", function() { }; return $delegate; }); + + return function($sniffer) { + if($sniffer.transitions) { + currentTimestamp = Date.now(); + spyOn(Date,'now').andCallFake(function() { + return currentTimestamp; + }); + } + } }) inject(function($animate, $rootScope, $compile, $sniffer, $timeout) { if (!$sniffer.transitions) return;