LibJS: Add notation to Intl.PluralRules

This is a normative change in the ECMA-402 spec. See:
a7ff535
This commit is contained in:
Timothy Flynn 2025-05-27 08:05:19 -04:00 committed by Tim Flynn
commit 8e5cc74eb1
Notes: github-actions[bot] 2025-05-27 14:40:25 +00:00
9 changed files with 101 additions and 29 deletions

View file

@ -117,6 +117,12 @@ describe("errors", () => {
}).toThrowWithMessage(RangeError, "Value 22 is NaN or is not between 1 and 21");
});
test("notation option is invalid ", () => {
expect(() => {
new Intl.PluralRules("en", { notation: "hello!" });
}).toThrowWithMessage(RangeError, "hello! is not a valid value for option notation");
});
test("roundingPriority option is invalid", () => {
expect(() => {
new Intl.PluralRules("en", { roundingPriority: "hello!" });
@ -239,6 +245,14 @@ describe("normal behavior", () => {
}
});
test("all valid notation options", () => {
["standard", "scientific", "engineering", "compact"].forEach(notation => {
expect(() => {
new Intl.PluralRules("en", { notation: notation });
}).not.toThrow();
});
});
test("all valid roundingPriority options", () => {
["auto", "morePrecision", "lessPrecision"].forEach(roundingPriority => {
expect(() => {