Commit b2c76d2e authored by Romain Courteaud's avatar Romain Courteaud

Queue: ensure Queue arguments are propagated without new

parent 27cc7f68
......@@ -21,7 +21,7 @@ var Queue = function(thenable) {
resolved;
if (!(this instanceof Queue)) {
return new Queue();
return new Queue(thenable);
}
function canceller() {
......
......@@ -2265,6 +2265,16 @@ describe("`RSVP.Queue`", function () {
}, 20);
});
it('should be fulfilled without new with the thenable argument', function (done) {
var queue = RSVP.Queue(RSVP.resolve('bar'));
setTimeout(function() {
assert.equal(queue.isFulfilled, true);
assert.equal(queue.fulfillmentValue, 'bar');
done();
}, 20);
});
it('should be rejected with the rejected thenable argument', function (done) {
var queue = new RSVP.Queue(RSVP.reject('ko'));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment