aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/qSpec.js
diff options
context:
space:
mode:
authorBrian Ford2013-08-21 16:40:20 -0700
committerBrian Ford2013-08-21 16:58:40 -0700
commit7d188d630c63fde05d8765d0ad2d75a5baa8e5d3 (patch)
tree8889de135b6f156e21a2d4bdb900d5351fd96bb2 /test/ng/qSpec.js
parent8ee9a3e902e523577f9ea331af56c7bad6b4eea9 (diff)
downloadangular.js-7d188d630c63fde05d8765d0ad2d75a5baa8e5d3.tar.bz2
fix($q): fix forwarding resolution when callbacks aren't functions
Uses the changes from @jamestalmage's fix in #3535. (thanks!) Closes #3535
Diffstat (limited to 'test/ng/qSpec.js')
-rw-r--r--test/ng/qSpec.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/ng/qSpec.js b/test/ng/qSpec.js
index bad67dcc..13c51f4b 100644
--- a/test/ng/qSpec.js
+++ b/test/ng/qSpec.js
@@ -730,6 +730,38 @@ describe('q', function() {
mockNextTick.flush();
expect(log).toEqual(['error(oops!)->reject(oops!)']);
});
+
+ it('should forward success resolution when success callbacks are not functions', function() {
+ deferred.resolve('yay!');
+
+ promise.then(1).
+ then(null).
+ then({}).
+ then('gah!').
+ then([]).
+ then(success());
+
+ expect(logStr()).toBe('');
+
+ mockNextTick.flush();
+ expect(log).toEqual(['success(yay!)->yay!']);
+ });
+
+ it('should forward error resolution when error callbacks are not functions', function() {
+ deferred.reject('oops!');
+
+ promise.then(null, 1).
+ then(null, null).
+ then(null, {}).
+ then(null, 'gah!').
+ then(null, []).
+ then(null, error());
+
+ expect(logStr()).toBe('');
+
+ mockNextTick.flush();
+ expect(log).toEqual(['error(oops!)->reject(oops!)']);
+ });
});