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

LibJS: Implement Intl.Locale.prototype.language

This commit is contained in:
Timothy Flynn 2021-09-02 08:19:29 -04:00 committed by Linus Groh
parent bdf36575c8
commit c3b6f43641
3 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,21 @@
describe("errors", () => {
test("called on non-Locale object", () => {
expect(() => {
Intl.Locale.prototype.language;
}).toThrowWithMessage(TypeError, "Not a Intl.Locale object");
});
});
describe("normal behavior", () => {
test("basic functionality", () => {
expect(new Intl.Locale("en").language).toBe("en");
expect(new Intl.Locale("en-Latn").language).toBe("en");
expect(new Intl.Locale("en-GB").language).toBe("en");
expect(new Intl.Locale("en", { script: "Latn" }).language).toBe("en");
expect(new Intl.Locale("en", { region: "GB" }).language).toBe("en");
expect(new Intl.Locale("en-u-ca-abc").language).toBe("en");
expect(new Intl.Locale("en", { calendar: "abc" }).language).toBe("en");
expect(new Intl.Locale("en-x-abcd").language).toBe("en");
});
});