Backed out 2 changesets (bug 1888310, bug 1884625) for causing failures on browser_ap...
[gecko.git] / js / src / tests / test262 / intl402 / Temporal / PlainYearMonth / prototype / toLocaleString / dateStyle.js
blobb4816e1b19d459fdd836143d0249dbdde23744ae
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2024 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-temporal.plainyearmonth.prototype.tolocalestring
7 description: Basic tests that dateStyle option affects output
8 locale: [en-u-ca-gregory, en-u-ca-islamic]
9 features: [Temporal, Intl.DateTimeFormat-datetimestyle]
10 ---*/
12 const dateGregorian = Temporal.PlainYearMonth.from({ year: 2024, monthCode: "M03", calendar: "gregory" });
14 assert(
15   dateGregorian.toLocaleString("en-u-ca-gregory", { dateStyle: "long" }).includes("March"),
16   "dateStyle: long writes month of March out in full"
18 assert(
19   !dateGregorian.toLocaleString("en-u-ca-gregory", { dateStyle: "short" }).includes("March"),
20   "dateStyle: short does not write month of March out in full"
23 const dateIslamic = Temporal.PlainYearMonth.from({ year: 1445, monthCode: "M09", calendar: "islamic" });
25 assert(
26   dateIslamic.toLocaleString("en-u-ca-islamic", { dateStyle: "long" }).includes("Ramadan"),
27   "dateStyle: long writes month of Ramadan out in full"
29 assert(
30   !dateIslamic.toLocaleString("en-u-ca-islamic", { dateStyle: "short" }).includes("Ramadan"),
31   "dateStyle: short does not write month of Ramadan out in full"
34 reportCompare(0, 0);