tor-browser

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

supportedValuesOf-calendar.js (916B)


      1 // |reftest| skip-if(!this.hasOwnProperty("Intl"))
      2 
      3 const calendars = Intl.supportedValuesOf("calendar");
      4 
      5 assertEq(new Set(calendars).size, calendars.length, "No duplicates are present");
      6 assertEqArray(calendars, [...calendars].sort(), "The list is sorted");
      7 
      8 const typeRE = /^[a-z0-9]{3,8}(-[a-z0-9]{3,8})*$/;
      9 for (let calendar of calendars) {
     10  assertEq(typeRE.test(calendar), true, `${calendar} matches the 'type' production`);
     11 }
     12 
     13 for (let calendar of calendars) {
     14  assertEq(new Intl.Locale("und", {calendar}).calendar, calendar, `${calendar} is canonicalised`);
     15 }
     16 
     17 for (let calendar of calendars) {
     18  let obj = new Intl.DateTimeFormat("en", {calendar});
     19  assertEq(obj.resolvedOptions().calendar, calendar, `${calendar} is supported by DateTimeFormat`);
     20 }
     21 
     22 assertEq(calendars.includes("gregory"), true, `Includes the Gregorian calendar`);
     23 
     24 if (typeof reportCompare === "function")
     25  reportCompare(true, true);