summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/locales-undefined.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/locales-undefined.js')
-rw-r--r--js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/locales-undefined.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/locales-undefined.js b/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/locales-undefined.js
new file mode 100644
index 0000000000..be3ff739ca
--- /dev/null
+++ b/js/src/tests/test262/intl402/Temporal/PlainYearMonth/prototype/toLocaleString/locales-undefined.js
@@ -0,0 +1,22 @@
+// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
+// Copyright (C) 2021 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-temporal.plainyearmonth.prototype.tolocalestring
+description: Omitting the locales argument defaults to the DateTimeFormat default
+features: [Temporal]
+---*/
+
+const defaultFormatter = new Intl.DateTimeFormat([], Object.create(null));
+const { calendar } = defaultFormatter.resolvedOptions();
+const yearmonth = new Temporal.PlainYearMonth(2000, 5, calendar);
+const expected = defaultFormatter.format(yearmonth);
+
+const actualExplicit = yearmonth.toLocaleString(undefined);
+assert.sameValue(actualExplicit, expected, "default locale is determined by Intl.DateTimeFormat");
+
+const actualImplicit = yearmonth.toLocaleString();
+assert.sameValue(actualImplicit, expected, "default locale is determined by Intl.DateTimeFormat");
+
+reportCompare(0, 0);