diff options
author | jaubourg <j@ubourg.net> | 2011-05-09 10:01:20 +0200 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-05-09 10:01:20 +0200 |
commit | 8c13cfa805c0576a2f02f33beb9d15d73afd2d41 (patch) | |
tree | 60800ca1ee6427e85cf51569ea1403d49e78f408 /test | |
parent | efd0fce7a1ae9bc62ef2b1aa51d7adc224da1ec0 (diff) | |
download | jquery-8c13cfa805c0576a2f02f33beb9d15d73afd2d41.tar.gz jquery-8c13cfa805c0576a2f02f33beb9d15d73afd2d41.zip |
Fixes #9104. Returning null or undefined in a pipe callback shouldn't end up throwing an exception. Silly, silly, me.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/deferred.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/unit/deferred.js b/test/unit/deferred.js index c71fbdbe7..89c9c612d 100644 --- a/test/unit/deferred.js +++ b/test/unit/deferred.js @@ -145,7 +145,7 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) { test( "jQuery.Deferred.pipe - filtering (done)", function() { - expect(3); + expect(4); var defer = jQuery.Deferred(), piped = defer.pipe(function( a, b ) { @@ -173,11 +173,15 @@ test( "jQuery.Deferred.pipe - filtering (done)", function() { jQuery.Deferred().reject().pipe(function() { ok( false, "pipe should not be called on reject" ); }); + + jQuery.Deferred().resolve().pipe( jQuery.noop ).done(function( value ) { + strictEqual( value, undefined, "pipe done callback can return undefined/null" ); + }); }); test( "jQuery.Deferred.pipe - filtering (fail)", function() { - expect(3); + expect(4); var defer = jQuery.Deferred(), piped = defer.pipe( null, function( a, b ) { @@ -205,6 +209,10 @@ test( "jQuery.Deferred.pipe - filtering (fail)", function() { jQuery.Deferred().resolve().pipe( null, function() { ok( false, "pipe should not be called on resolve" ); } ); + + jQuery.Deferred().reject().pipe( null, jQuery.noop ).fail(function( value ) { + strictEqual( value, undefined, "pipe fail callback can return undefined/null" ); + }); }); test( "jQuery.Deferred.pipe - deferred (done)", function() { |