diff --git a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp index ce69d0dd6b..7ecc6fafc5 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.cpp @@ -324,11 +324,11 @@ ThrowCompletionOr set_number_format_digit_options(VM& vm, NumberFormatBase if (need_fraction_digits) { // a. If hasFd is true, then if (has_fraction_digits) { - // i. Set mnfd to ? DefaultNumberOption(mnfd, 0, 20, undefined). - auto min_digits = TRY(default_number_option(vm, min_fraction_digits, 0, 20, {})); + // i. Set mnfd to ? DefaultNumberOption(mnfd, 0, 100, undefined). + auto min_digits = TRY(default_number_option(vm, min_fraction_digits, 0, 100, {})); - // ii. Set mxfd to ? DefaultNumberOption(mxfd, 0, 20, undefined). - auto max_digits = TRY(default_number_option(vm, max_fraction_digits, 0, 20, {})); + // ii. Set mxfd to ? DefaultNumberOption(mxfd, 0, 100, undefined). + auto max_digits = TRY(default_number_option(vm, max_fraction_digits, 0, 100, {})); // iii. If mnfd is undefined, set mnfd to min(mnfdDefault, mxfd). if (!min_digits.has_value()) diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js index 61e76e570f..22ed4d99e3 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/NumberFormat/NumberFormat.js @@ -128,15 +128,15 @@ describe("errors", () => { expect(() => { new Intl.NumberFormat("en", { minimumFractionDigits: "hello!" }); - }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 100"); expect(() => { new Intl.NumberFormat("en", { minimumFractionDigits: -1 }); - }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 100"); expect(() => { - new Intl.NumberFormat("en", { minimumFractionDigits: 21 }); - }).toThrowWithMessage(RangeError, "Value 21 is NaN or is not between 0 and 20"); + new Intl.NumberFormat("en", { minimumFractionDigits: 101 }); + }).toThrowWithMessage(RangeError, "Value 101 is NaN or is not between 0 and 100"); }); test("maximumFractionDigits option is invalid ", () => { @@ -146,15 +146,15 @@ describe("errors", () => { expect(() => { new Intl.NumberFormat("en", { maximumFractionDigits: "hello!" }); - }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 100"); expect(() => { new Intl.NumberFormat("en", { maximumFractionDigits: -1 }); - }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 100"); expect(() => { - new Intl.NumberFormat("en", { maximumFractionDigits: 21 }); - }).toThrowWithMessage(RangeError, "Value 21 is NaN or is not between 0 and 20"); + new Intl.NumberFormat("en", { maximumFractionDigits: 101 }); + }).toThrowWithMessage(RangeError, "Value 101 is NaN or is not between 0 and 100"); expect(() => { new Intl.NumberFormat("en", { minimumFractionDigits: 10, maximumFractionDigits: 5 }); @@ -370,7 +370,7 @@ describe("normal behavior", () => { }); test("all valid minimumFractionDigits options", () => { - for (let i = 0; i <= 20; ++i) { + for (let i = 0; i <= 100; ++i) { expect(() => { new Intl.NumberFormat("en", { minimumFractionDigits: i }); }).not.toThrow(); @@ -378,7 +378,7 @@ describe("normal behavior", () => { }); test("all valid maximumFractionDigits options", () => { - for (let i = 0; i <= 20; ++i) { + for (let i = 0; i <= 100; ++i) { expect(() => { new Intl.NumberFormat("en", { maximumFractionDigits: i }); }).not.toThrow(); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js index a74537dec0..cfa5557727 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/PluralRules/PluralRules.js @@ -48,15 +48,15 @@ describe("errors", () => { expect(() => { new Intl.PluralRules("en", { minimumFractionDigits: "hello!" }); - }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 100"); expect(() => { new Intl.PluralRules("en", { minimumFractionDigits: -1 }); - }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 100"); expect(() => { - new Intl.PluralRules("en", { minimumFractionDigits: 21 }); - }).toThrowWithMessage(RangeError, "Value 21 is NaN or is not between 0 and 20"); + new Intl.PluralRules("en", { minimumFractionDigits: 101 }); + }).toThrowWithMessage(RangeError, "Value 101 is NaN or is not between 0 and 100"); }); test("maximumFractionDigits option is invalid ", () => { @@ -66,15 +66,15 @@ describe("errors", () => { expect(() => { new Intl.PluralRules("en", { maximumFractionDigits: "hello!" }); - }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value NaN is NaN or is not between 0 and 100"); expect(() => { new Intl.PluralRules("en", { maximumFractionDigits: -1 }); - }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 20"); + }).toThrowWithMessage(RangeError, "Value -1 is NaN or is not between 0 and 100"); expect(() => { - new Intl.PluralRules("en", { maximumFractionDigits: 21 }); - }).toThrowWithMessage(RangeError, "Value 21 is NaN or is not between 0 and 20"); + new Intl.PluralRules("en", { maximumFractionDigits: 101 }); + }).toThrowWithMessage(RangeError, "Value 101 is NaN or is not between 0 and 100"); expect(() => { new Intl.PluralRules("en", { minimumFractionDigits: 10, maximumFractionDigits: 5 }); @@ -208,7 +208,7 @@ describe("normal behavior", () => { }); test("all valid minimumFractionDigits options", () => { - for (let i = 0; i <= 20; ++i) { + for (let i = 0; i <= 100; ++i) { expect(() => { new Intl.PluralRules("en", { minimumFractionDigits: i }); }).not.toThrow(); @@ -216,7 +216,7 @@ describe("normal behavior", () => { }); test("all valid maximumFractionDigits options", () => { - for (let i = 0; i <= 20; ++i) { + for (let i = 0; i <= 100; ++i) { expect(() => { new Intl.PluralRules("en", { maximumFractionDigits: i }); }).not.toThrow();