summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Intl/ListFormat/supported-locales.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/Intl/ListFormat/supported-locales.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/tests/non262/Intl/ListFormat/supported-locales.js b/js/src/tests/non262/Intl/ListFormat/supported-locales.js
new file mode 100644
index 0000000000..f5d05e2da5
--- /dev/null
+++ b/js/src/tests/non262/Intl/ListFormat/supported-locales.js
@@ -0,0 +1,18 @@
+// |reftest| skip-if(!this.hasOwnProperty('Intl'))
+
+// Intl.ListFormat.supportedLocalesOf returns an empty array for unsupported locales.
+assertEq(Intl.ListFormat.supportedLocalesOf("art-lobjan").length, 0);
+
+// And a non-empty array for supported locales.
+assertEq(Intl.ListFormat.supportedLocalesOf("en").length, 1);
+assertEq(Intl.ListFormat.supportedLocalesOf("en")[0], "en");
+
+// If the locale is supported per |Intl.ListFormat.supportedLocalesOf|, the resolved locale
+// should reflect this.
+for (let locale of Intl.ListFormat.supportedLocalesOf(["en", "de", "th", "ar"])) {
+ let lf = new Intl.ListFormat(locale);
+ assertEq(lf.resolvedOptions().locale, locale);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);