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

LibJS: Implement Intl.Locale.prototype.region

This commit is contained in:
Timothy Flynn 2021-09-02 08:25:20 -04:00 committed by Linus Groh
parent 349fd06b86
commit 32825107de
3 changed files with 46 additions and 0 deletions

View file

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