Debian Codegraph @

js/src/tests/non262/Intl/DisplayNames/abbreviated.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras'))
2
3 addMozIntlDisplayNames(this);
4
5 const tests = {
6 "en": {
7 long: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
8 abbreviated: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
9 short: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
10 narrow: ["M", "T", "W", "T", "F", "S", "S"],
11 },
12 };
13
14 for (let [locale, localeTests] of Object.entries(tests)) {
15 for (let [style, weekdays] of Object.entries(localeTests)) {
16 let dn = new Intl.DisplayNames(locale, {type: "weekday", style});
17
18 let resolved = dn.resolvedOptions();
19 assertEq(resolved.style, style);
20
21 for (let [day, expected] of weekdays.entries()) {
22 assertEq(dn.of(day + 1), expected);
23 }
24 }
25 }
26
27 if (typeof reportCompare === "function")
28 reportCompare(true, true);