diff options
author | jaubourg <j@ubourg.net> | 2011-11-09 01:02:29 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-11-09 01:02:29 +0100 |
commit | 2a9f0681dee3a6421bafd2fbc4451c9fe364b6ca (patch) | |
tree | 3ce24d063a62f433d2fd6b383e7062ac1665f152 /test | |
parent | c3600e261ba8d9394fe505ef5a0611b6d6b18a8d (diff) | |
download | jquery-2a9f0681dee3a6421bafd2fbc4451c9fe364b6ca.tar.gz jquery-2a9f0681dee3a6421bafd2fbc4451c9fe364b6ca.zip |
Have Deferred.always return the object onto which it is currently attached to enable true chainability. Fixes #10723. Unit tests added.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/deferred.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/deferred.js b/test/unit/deferred.js index eab14da2d..4a50da2c1 100644 --- a/test/unit/deferred.js +++ b/test/unit/deferred.js @@ -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); |