Skip to content
Permalink
Browse files
Fix #10967: jQuery.fn.promise returns provided object
  • 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.
@@ -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.