2014-10-23 19:58:31 +02:00
|
|
|
// Copyright 2014 Cubane Canada, Inc. All rights reserved.
|
|
|
|
// See LICENSE for details.
|
|
|
|
|
|
|
|
/*---
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2014-10-23 19:58:31 +02:00
|
|
|
Promise.all with 2-element array
|
2015-02-10 22:01:39 +01:00
|
|
|
es6id: S25.4.4.1_A8.1_T1
|
2014-10-23 19:58:31 +02:00
|
|
|
author: Sam Mikes
|
|
|
|
description: Promise.all() rejects when a promise in its array rejects
|
2016-02-12 18:59:51 +01:00
|
|
|
flags: [async]
|
2014-10-23 19:58:31 +02:00
|
|
|
---*/
|
|
|
|
|
|
|
|
var rejectP1,
|
2018-02-09 18:09:47 +01:00
|
|
|
p1 = new Promise(function (resolve, reject) {
|
|
|
|
rejectP1 = reject;
|
|
|
|
}),
|
|
|
|
p2 = Promise.resolve(2);
|
2014-10-23 19:58:31 +02:00
|
|
|
|
2018-02-09 18:09:47 +01:00
|
|
|
Promise.all([p1, p2]).then(function (resolve) {
|
|
|
|
$ERROR("Did not expect promise to be fulfilled.");
|
|
|
|
}, function (rejected) {
|
|
|
|
if (rejected !== 1) {
|
|
|
|
$ERROR("Expected promise to be rejected with 1, actually " + rejected);
|
|
|
|
}
|
2014-10-23 19:58:31 +02:00
|
|
|
}).then($DONE, $DONE);
|
|
|
|
|
|
|
|
rejectP1(1);
|