1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:07:34 +00:00

LibJS: Handle existing Intl.Locale objects in CanonicalizeLocaleList

This commit is contained in:
Timothy Flynn 2021-09-01 22:26:06 -04:00 committed by Linus Groh
parent 4de05faa8a
commit 27fc3cfe75
2 changed files with 22 additions and 8 deletions

View file

@ -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"]);
});
});