]> source.dussan.org Git - jquery.git/commitdiff
Revert "Deferred: add .catch handler"
authorOleg Gaidarenko <markelog@gmail.com>
Tue, 22 Dec 2015 12:04:48 +0000 (15:04 +0300)
committerOleg Gaidarenko <markelog@gmail.com>
Tue, 22 Dec 2015 12:04:48 +0000 (15:04 +0300)
This reverts commit ef77f83db86b806425203d1e5ecbcc119d7b9c32.

src/deferred.js
test/unit/deferred.js

index 10e59a57141fbc4e417225c1bb27753ad3d359ce..c4d61446b5e83409944faa7f349aa9905564bc75 100644 (file)
@@ -34,9 +34,6 @@ jQuery.extend( {
                                        deferred.done( arguments ).fail( arguments );
                                        return this;
                                },
-                               "catch": function( fn ) {
-                                       return promise.then( null, fn );
-                               },
 
                                // Keep pipe for back-compat
                                pipe: function( /* fnDone, fnFail, fnProgress */ ) {
index 2277df1903188a458b780d351e1b3369e42deac0..9541ca16deb70acb66d4a78d2fe73498310ba2ab 100644 (file)
@@ -166,44 +166,7 @@ QUnit.test( "jQuery.Deferred.then - filtering (fail)", function( assert ) {
        } );
 } );
 
-QUnit.test( "jQuery.Deferred.catch", function( assert ) {
-       assert.expect( 4 );
-
-       var value1, value2, value3,
-               defer = jQuery.Deferred(),
-               piped = defer[ "catch" ]( function( a, b ) {
-                       return a * b;
-               } ),
-               done = jQuery.map( new Array( 3 ), function() { return assert.async(); } );
-
-       piped.done( function( result ) {
-               value3 = result;
-       } );
-
-       defer.fail( function( a, b ) {
-               value1 = a;
-               value2 = b;
-       } );
-
-       defer.reject( 2, 3 )[ "catch" ]( function() {
-               assert.strictEqual( value1, 2, "first reject value ok" );
-               assert.strictEqual( value2, 3, "second reject value ok" );
-               assert.strictEqual( value3, 6, "result of filter ok" );
-               done.pop().call();
-       } );
-
-       jQuery.Deferred().resolve()[ "catch" ]( function() {
-               assert.ok( false, "then should not be called on resolve" );
-       } ).then( done.pop() );
-
-       jQuery.Deferred().reject()[ "catch" ]( jQuery.noop ).done( function( value ) {
-               assert.strictEqual( value, undefined, "then fail callback can return undefined/null" );
-               done.pop().call();
-       } );
-} );
-
 QUnit.test( "[PIPE ONLY] jQuery.Deferred.pipe - filtering (fail)", function( assert ) {
-
        assert.expect( 4 );
 
        var value1, value2, value3,