From 021bdf3922b6525bd117e59fb4945b30a5a55341 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 16 Apr 2013 09:53:35 -0700 Subject: fix($animator): remove dependency on window.setTimeout. --- test/ng/animatorSpec.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/ng/animatorSpec.js b/test/ng/animatorSpec.js index 4d549ee3..1b393e91 100644 --- a/test/ng/animatorSpec.js +++ b/test/ng/animatorSpec.js @@ -28,20 +28,27 @@ describe("$animator", function() { }); }); - it("should disable and enable the animations", inject(function($animator, $rootScope, $window) { - expect($animator.enabled()).toBe(false); + it("should disable and enable the animations", function() { + var initialState = null; + var animator; - $rootScope.$digest(); - $window.setTimeout.expect(0).process(); + angular.bootstrap(body, [function() { + return function($animator) { + animator = $animator; + initialState = $animator.enabled(); + } + }]); - expect($animator.enabled()).toBe(true); + expect(initialState).toBe(false); - expect($animator.enabled(0)).toBe(false); - expect($animator.enabled()).toBe(false); + expect(animator.enabled()).toBe(true); - expect($animator.enabled(1)).toBe(true); - expect($animator.enabled()).toBe(true); - })); + expect(animator.enabled(0)).toBe(false); + expect(animator.enabled()).toBe(false); + + expect(animator.enabled(1)).toBe(true); + expect(animator.enabled()).toBe(true); + }); }); @@ -145,9 +152,6 @@ describe("$animator", function() { ngAnimate : '{enter: \'custom\'}' }); - $rootScope.$digest(); // re-enable the animations; - window.setTimeout.expect(0).process(); - expect(element.contents().length).toBe(0); animator.enter(child, element); window.setTimeout.expect(1).process(); @@ -158,9 +162,6 @@ describe("$animator", function() { ngAnimate : '{leave: \'custom\'}' }); - $rootScope.$digest(); // re-enable the animations; - window.setTimeout.expect(0).process(); - element.append(child); expect(element.contents().length).toBe(1); animator.leave(child, element); -- cgit v1.2.3