From 1904596e0c2330299e92f092bd7a6ceca8e97c30 Mon Sep 17 00:00:00 2001 From: Ali Mills Date: Fri, 1 Jun 2012 14:50:01 -0700 Subject: fix($timeout): allow calling $timeout.cancel() with undefined This is how it worked in rc9, before refactoring $defer into $timeout.--- test/ng/timeoutSpec.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ng/timeoutSpec.js') diff --git a/test/ng/timeoutSpec.js b/test/ng/timeoutSpec.js index 19db1227..5ee99d98 100644 --- a/test/ng/timeoutSpec.js +++ b/test/ng/timeoutSpec.js @@ -142,5 +142,10 @@ describe('$timeout', function() { expect($timeout.cancel(promise1)).toBe(false); expect($timeout.cancel(promise2)).toBe(true); })); + + + it('should not throw a runtime exception when given an undefined promise', inject(function($timeout) { + expect($timeout.cancel()).toBe(false); + })); }); }); -- cgit v1.2.3