aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/qSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/qSpec.js')
-rw-r--r--test/ng/qSpec.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ng/qSpec.js b/test/ng/qSpec.js
index 6d08cb15..4f2492fb 100644
--- a/test/ng/qSpec.js
+++ b/test/ng/qSpec.js
@@ -516,6 +516,10 @@ describe('q', function() {
expect(typeof promise.then).toBe('function');
});
+ it('should have a catch method', function() {
+ expect(typeof promise['catch']).toBe('function');
+ });
+
it('should have a always method', function() {
expect(typeof promise.always).toBe('function');
});
@@ -881,6 +885,14 @@ describe('q', function() {
});
});
+
+ describe('catch', function() {
+ it('should be a shorthand for defining promise error handlers', function() {
+ promise['catch'](error(1)).then(null, error(2))
+ syncReject(deferred, 'foo');
+ expect(logStr()).toBe('error1(foo)->reject(foo); error2(foo)->reject(foo)');
+ });
+ });
});
});