From cbf06a5d64aba537f0e2679a194d3998d8365493 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sat, 24 Aug 2013 14:18:47 -0700 Subject: feat(mocks): make $timeout#flush throw an exception when empty When calling $timeout.flush with or without a delay an exception should be thrown if there is nothing to be flushed. This prevents tests from flushing stuff unnecessarily. BREAKING CHANGE: calling $timeout.flush(delay) when there is no task to be flushed within the delay throws an exception now. Please adjust the delay or remove the flush call from your tests as the exception is a signed of a programming error. --- test/ng/timeoutSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/ng') diff --git a/test/ng/timeoutSpec.js b/test/ng/timeoutSpec.js index 832528e9..e4a2bc39 100644 --- a/test/ng/timeoutSpec.js +++ b/test/ng/timeoutSpec.js @@ -14,7 +14,7 @@ describe('$timeout', function() { $browser.defer.flush(); expect(counter).toBe(1); - expect(function() {$browser.defer.flush();}).toThrow('No deferred tasks to be flushed'); + expect(function() {$browser.defer.flush();}).toThrow('No deferred tasks to be flushed!'); expect(counter).toBe(1); })); -- cgit v1.2.3