aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2011-12-09 12:41:35 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-02-13 21:53:42 -0500
commit6c2b64dfa5e1d6f90c74f0f1719e9f11f52de7a4 (patch)
treefba30baf025fcfd4c42ff944b91ef60b42326c86
parenta8dd45547cb32a6c5505e139ece70b71cfc97ee8 (diff)
downloadjquery-6c2b64dfa5e1d6f90c74f0f1719e9f11f52de7a4.tar.gz
jquery-6c2b64dfa5e1d6f90c74f0f1719e9f11f52de7a4.zip
Fix #10967: jQuery.fn.promise returns provided object
-rw-r--r--src/queue.js2
-rw-r--r--test/unit/queue.js10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/queue.js b/src/queue.js
index da3e59721..907baf4d6 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -174,7 +174,7 @@ jQuery.fn.extend({
}
}
resolve();
- return defer.promise();
+ return defer.promise( object );
}
});
diff --git a/test/unit/queue.js b/test/unit/queue.js
index bb2d6ba9e..e6291ffb7 100644
--- a/test/unit/queue.js
+++ b/test/unit/queue.js
@@ -293,3 +293,13 @@ test("promise()", function() {
this.dequeue();
});
});
+
+test(".promise(obj)", function() {
+ expect(2);
+
+ var obj = {};
+ var promise = jQuery( "#foo" ).promise( "promise", obj );
+
+ ok( jQuery.isFunction( promise.promise ), ".promise(type, obj) returns a promise" );
+ strictEqual( promise, obj, ".promise(type, obj) returns obj" );
+});