mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:47:35 +00:00
LibJS: Implement Intl.Locale.prototype.numberingSystems property
This commit is contained in:
parent
ee2be5895f
commit
f6aa6a480c
6 changed files with 61 additions and 1 deletions
|
@ -0,0 +1,35 @@
|
|||
describe("errors", () => {
|
||||
test("called on non-Locale object", () => {
|
||||
expect(() => {
|
||||
Intl.Locale.prototype.numberingSystems;
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Intl.Locale");
|
||||
});
|
||||
});
|
||||
|
||||
describe("normal behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
expect(Array.isArray(new Intl.Locale("en").numberingSystems)).toBeTrue();
|
||||
expect(new Intl.Locale("en").numberingSystems).toEqual(["latn"]);
|
||||
|
||||
expect(Array.isArray(new Intl.Locale("ar").numberingSystems)).toBeTrue();
|
||||
expect(new Intl.Locale("ar").numberingSystems).toEqual(["arab", "latn"]);
|
||||
});
|
||||
|
||||
test("extension keyword overrides default data", () => {
|
||||
expect(new Intl.Locale("en-u-nu-deva").numberingSystems).toEqual(["deva"]);
|
||||
expect(new Intl.Locale("en", { numberingSystem: "deva" }).numberingSystems).toEqual([
|
||||
"deva",
|
||||
]);
|
||||
|
||||
expect(new Intl.Locale("ar-u-nu-bali").numberingSystems).toEqual(["bali"]);
|
||||
expect(new Intl.Locale("ar", { numberingSystem: "bali" }).numberingSystems).toEqual([
|
||||
"bali",
|
||||
]);
|
||||
|
||||
// Invalid numberingSystems also take precedence.
|
||||
expect(new Intl.Locale("en-u-nu-ladybird").numberingSystems).toEqual(["ladybird"]);
|
||||
expect(new Intl.Locale("en", { numberingSystem: "ladybird" }).numberingSystems).toEqual([
|
||||
"ladybird",
|
||||
]);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue