aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/timeoutSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/timeoutSpec.js')
-rw-r--r--test/ng/timeoutSpec.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ng/timeoutSpec.js b/test/ng/timeoutSpec.js
index 8de63bec..97c8448e 100644
--- a/test/ng/timeoutSpec.js
+++ b/test/ng/timeoutSpec.js
@@ -165,6 +165,20 @@ describe('$timeout', function() {
}));
+ it('should cancel the promise', inject(function($timeout, log) {
+ var promise = $timeout(noop);
+ promise.then(function(value) { log('promise success: ' + value); },
+ function(err) { log('promise error: ' + err); },
+ function(note) { log('promise update: ' + note); });
+ expect(log).toEqual([]);
+
+ $timeout.cancel(promise);
+ $timeout.flush();
+
+ expect(log).toEqual(['promise error: canceled']);
+ }));
+
+
it('should return true if a task was successfully canceled', inject(function($timeout) {
var task1 = jasmine.createSpy('task1'),
task2 = jasmine.createSpy('task2'),