mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibJS: Implement Intl.Locale.prototype.textInfo property
This commit is contained in:
parent
4868b888be
commit
88a560dd84
6 changed files with 70 additions and 0 deletions
|
@ -0,0 +1,26 @@
|
|||
describe("errors", () => {
|
||||
test("called on non-Locale object", () => {
|
||||
expect(() => {
|
||||
Intl.Locale.prototype.textInfo;
|
||||
}).toThrowWithMessage(TypeError, "Not an object of type Intl.Locale");
|
||||
});
|
||||
});
|
||||
|
||||
describe("normal behavior", () => {
|
||||
test("basic functionality", () => {
|
||||
const textInfo = new Intl.Locale("en").textInfo;
|
||||
|
||||
expect(textInfo).toBeDefined();
|
||||
expect(Object.getPrototypeOf(textInfo)).toBe(Object.prototype);
|
||||
|
||||
expect(textInfo.direction).toBeDefined();
|
||||
expect(Object.getPrototypeOf(textInfo.direction)).toBe(String.prototype);
|
||||
|
||||
expect(textInfo.direction).toBe("ltr");
|
||||
expect(new Intl.Locale("ar").textInfo.direction).toBe("rtl");
|
||||
});
|
||||
|
||||
test("fallback to ltr", () => {
|
||||
expect(new Intl.Locale("xx").textInfo.direction).toBe("ltr");
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue