Backed out 2 changesets (bug 1888310, bug 1884625) for causing failures on browser_ap...
[gecko.git] / js / src / tests / test262 / intl402 / Temporal / PlainDate / prototype / toLocaleString / dateStyle.js
blob0bb42308d57eecc422624531e41b286da2d717f4
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.plaindate.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 = new Temporal.PlainDate(2024, 3, 26, "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 = new Temporal.PlainDate(2024, 3, 26, "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);