mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
committed by
Andreas Kling
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/93712b24bf2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256 Reviewed-by: https://github.com/sideshowbarker
@@ -0,0 +1,96 @@
|
||||
describe("errors", () => {
|
||||
test("called without new", () => {
|
||||
expect(() => {
|
||||
Intl.RelativeTimeFormat();
|
||||
}).toThrowWithMessage(
|
||||
TypeError,
|
||||
"Intl.RelativeTimeFormat constructor must be called with 'new'"
|
||||
);
|
||||
});
|
||||
|
||||
test("structurally invalid tag", () => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("root");
|
||||
}).toThrowWithMessage(RangeError, "root is not a structurally valid language tag");
|
||||
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en-");
|
||||
}).toThrowWithMessage(RangeError, "en- is not a structurally valid language tag");
|
||||
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("Latn");
|
||||
}).toThrowWithMessage(RangeError, "Latn is not a structurally valid language tag");
|
||||
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en-u-aa-U-aa");
|
||||
}).toThrowWithMessage(RangeError, "en-u-aa-U-aa is not a structurally valid language tag");
|
||||
});
|
||||
|
||||
test("options is an invalid type", () => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", null);
|
||||
}).toThrowWithMessage(TypeError, "ToObject on null or undefined");
|
||||
});
|
||||
|
||||
test("localeMatcher option is invalid", () => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { localeMatcher: "hello!" });
|
||||
}).toThrowWithMessage(RangeError, "hello! is not a valid value for option localeMatcher");
|
||||
});
|
||||
|
||||
test("numberingSystem option is invalid", () => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { numberingSystem: "hello!" });
|
||||
}).toThrowWithMessage(RangeError, "hello! is not a valid value for option numberingSystem");
|
||||
});
|
||||
|
||||
test("style option is invalid", () => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { style: "hello!" });
|
||||
}).toThrowWithMessage(RangeError, "hello! is not a valid value for option style");
|
||||
});
|
||||
|
||||
test("numeric option is invalid", () => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { numeric: "hello!" });
|
||||
}).toThrowWithMessage(RangeError, "hello! is not a valid value for option numeric");
|
||||
});
|
||||
});
|
||||
|
||||
describe("normal behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Intl.RelativeTimeFormat).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("all valid localeMatcher options", () => {
|
||||
["lookup", "best fit"].forEach(localeMatcher => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { localeMatcher: localeMatcher });
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
test("valid numberingSystem options", () => {
|
||||
["latn", "arab", "abc-def-ghi"].forEach(numberingSystem => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { numberingSystem: numberingSystem });
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
test("all valid style options", () => {
|
||||
["long", "short", "narrow"].forEach(style => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { style: style });
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
test("all valid numeric options", () => {
|
||||
["always", "auto"].forEach(numeric => {
|
||||
expect(() => {
|
||||
new Intl.RelativeTimeFormat("en", { numeric: numeric });
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user