Permalink
Browse files

Fix #10967: jQuery.fn.promise returns provided object

  • Loading branch information...
gibson042 authored and dmethvin committed Dec 9, 2011
1 parent a8dd455 commit 6c2b64dfa5e1d6f90c74f0f1719e9f11f52de7a4
Showing with 11 additions and 1 deletion.
  1. +1 −1 src/queue.js
  2. +10 −0 test/unit/queue.js
@@ -174,7 +174,7 @@ jQuery.fn.extend({
}
}
resolve();
return defer.promise();
return defer.promise( object );
}
});

@@ -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" );
});

0 comments on commit 6c2b64d

Please sign in to comment.