summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-09-01 22:26:06 -0400
committerLinus Groh <mail@linusgroh.de>2021-09-02 17:56:42 +0100
commit27fc3cfe75df511eb657dbe6304683ef0bb4ec86 (patch)
tree83c1ee93f38b97b41a0279cd0f3cc51e62c86b46 /Userland/Libraries/LibJS/Tests
parent4de05faa8a85b5d6fd7304bab082c441b4a5afb2 (diff)
downloadserenity-27fc3cfe75df511eb657dbe6304683ef0bb4ec86.zip
LibJS: Handle existing Intl.Locale objects in CanonicalizeLocaleList
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js
index 4164897e23..bda470aa46 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/Intl.getCanonicalLocales.js
@@ -115,4 +115,12 @@ describe("normal behavior", () => {
"en-US-u-1k-aaa-2k-ccc",
]);
});
+
+ test("canonicalize locale objects", () => {
+ const en = new Intl.Locale("en", { script: "Latn" });
+ expect(Intl.getCanonicalLocales(en)).toEqual(["en-Latn"]);
+
+ const es = new Intl.Locale("es", { region: "419" });
+ expect(Intl.getCanonicalLocales([en, es])).toEqual(["en-Latn", "es-419"]);
+ });
});