tor-browser

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

supportedValuesOf-currency.js (912B)


      1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
      2 
      3 const currencies = Intl.supportedValuesOf("currency");
      4 
      5 assertEq(new Set(currencies).size, currencies.length, "No duplicates are present");
      6 assertEqArray(currencies, [...currencies].sort(), "The list is sorted");
      7 
      8 const codeRE = /^[A-Z]{3}$/;
      9 for (let currency of currencies) {
     10  assertEq(codeRE.test(currency), true, `${currency} is a 3-letter ISO 4217 currency code`);
     11 }
     12 
     13 for (let currency of currencies) {
     14  let obj = new Intl.NumberFormat("en", {style: "currency", currency});
     15  assertEq(obj.resolvedOptions().currency, currency, `${currency} is supported by NumberFormat`);
     16 }
     17 
     18 for (let currency of currencies) {
     19  let obj = new Intl.DisplayNames("en", {type: "currency", fallback: "none"});
     20  assertEq(typeof obj.of(currency), "string", `${currency} is supported by DisplayNames`);
     21 }
     22 
     23 if (typeof reportCompare === "function")
     24  reportCompare(true, true);