mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Have Deferred.always return the object onto which it is currently attached to enable true chainability. Fixes #10723. Unit tests added.
This commit is contained in:
@@ -56,6 +56,19 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
|
||||
});
|
||||
} );
|
||||
|
||||
test( "jQuery.Deferred - chainability", function() {
|
||||
|
||||
var methods = "resolve reject notify resolveWith rejectWith notifyWith done fail progress then always".split( " " ),
|
||||
defer = jQuery.Deferred();
|
||||
|
||||
expect( methods.length );
|
||||
|
||||
jQuery.each( methods, function( _, method ) {
|
||||
var object = { m: defer[ method ] };
|
||||
strictEqual( object.m(), object, method + " is chainable" );
|
||||
});
|
||||
});
|
||||
|
||||
test( "jQuery.Deferred.pipe - filtering (done)", function() {
|
||||
|
||||
expect(4);
|
||||
|
||||
Reference in New Issue
Block a user