Backed out 2 changesets (bug 1888310, bug 1884625) for causing failures on browser_ap...
[gecko.git] / js / src / tests / test262 / intl402 / Temporal / PlainMonthDay / prototype / toLocaleString / dateStyle.js
blob90113935926b5da4e51f06c38c612bf8e4ca80b2
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.plainmonthday.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.PlainMonthDay.from({ monthCode: "M03", day: 26, 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.PlainMonthDay.from({ monthCode: "M09", day: 16, 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);