tor-browser

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

constructor-numberingSystem-order.js (1277B)


      1 // Copyright 2019 Google Inc.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-initializenumberformat
      6 description: >
      7  Checks the order of getting "numberingSystem" option in the
      8  NumberFormat is between "localeMatcher" and "style" options.
      9 info: |
     10  InitializeNumberFormat ( _numberFormat_, _locales_, _options_ )
     11 
     12  5. Let _matcher_ be ? GetOption(_options_, `"localeMatcher"`, `"string"`, « `"lookup"`, `"best fit"` », `"best fit"`).
     13  ...
     14  7. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`, `"string"`, *undefined*, *undefined*).
     15  ...
     16  17. Let _style_ be ? GetOption(_options_, `"style"`, `"string"`, « `"decimal"`, `"percent"`, `"currency"` », `"decimal"`).
     17 includes: [compareArray.js]
     18 ---*/
     19 
     20 var actual = [];
     21 
     22 const options = {
     23  get localeMatcher() {
     24    actual.push("localeMatcher");
     25    return undefined;
     26  },
     27  get numberingSystem() {
     28    actual.push("numberingSystem");
     29    return undefined;
     30  },
     31  get style() {
     32    actual.push("style");
     33    return undefined;
     34  },
     35 };
     36 
     37 const expected = [
     38  "localeMatcher",
     39  "numberingSystem",
     40  "style"
     41 ];
     42 
     43 let nf = new Intl.NumberFormat(undefined, options);
     44 assert.compareArray(actual, expected);
     45 
     46 reportCompare(0, 0);