tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S25.4.4.1_A7.2_T1.js (982B)


      1 // |reftest| async
      2 // Copyright 2014 Cubane Canada, Inc.  All rights reserved.
      3 // See LICENSE for details.
      4 
      5 /*---
      6 info: |
      7    Promise.all with 1-element array
      8    should accept an array with settled promise
      9 es6id: S25.4.4.1_A7.2_T1
     10 author: Sam Mikes
     11 description: Promise.all() accepts a one-element array
     12 includes: [promiseHelper.js]
     13 flags: [async]
     14 ---*/
     15 
     16 var sequence = [];
     17 
     18 var p1 = new Promise(function(resolve) {
     19  resolve({});
     20 });
     21 
     22 sequence.push(1);
     23 
     24 Promise.all([p1]).then(function(resolved) {
     25  sequence.push(4);
     26  assert.sameValue(sequence.length, 4);
     27  checkSequence(sequence, "Expected Promise.all().then to queue second");
     28 }).catch($DONE);
     29 
     30 p1.then(function() {
     31  sequence.push(3);
     32  assert.sameValue(sequence.length, 3);
     33  checkSequence(sequence, "Expected p1.then to queue first");
     34 }).then(function() {
     35  sequence.push(5);
     36  assert.sameValue(sequence.length, 5);
     37  checkSequence(sequence, "Expected final then to queue last");
     38 }).then($DONE, $DONE);
     39 
     40 sequence.push(2);