Skip to content

Commit

Permalink
Fix #10967: jQuery.fn.promise returns provided object
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 authored and dmethvin committed Feb 14, 2012
1 parent a8dd455 commit 6c2b64d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/queue.js
Expand Up @@ -174,7 +174,7 @@ jQuery.fn.extend({
} }
} }
resolve(); resolve();
return defer.promise(); return defer.promise( object );
} }
}); });


Expand Down
10 changes: 10 additions & 0 deletions test/unit/queue.js
Expand Up @@ -293,3 +293,13 @@ test("promise()", function() {
this.dequeue(); 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.