mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibJS: Set approximate number range format result's "source" to "shared"
This is a normative change in the Intl.NumberFormat v3 spec. See:
7510e7f
This commit is contained in:
parent
9b6fcd8591
commit
d1881da2be
2 changed files with 25 additions and 14 deletions
|
@ -56,8 +56,8 @@ describe("correct behavior", () => {
|
|||
test("approximately formatting", () => {
|
||||
const en1 = new Intl.NumberFormat("en", { maximumFractionDigits: 0 });
|
||||
expect(en1.formatRangeToParts(2.9, 3.1)).toEqual([
|
||||
{ type: "approximatelySign", value: "~", source: "" },
|
||||
{ type: "integer", value: "3", source: "" },
|
||||
{ type: "approximatelySign", value: "~", source: "shared" },
|
||||
{ type: "integer", value: "3", source: "shared" },
|
||||
]);
|
||||
|
||||
const en2 = new Intl.NumberFormat("en", {
|
||||
|
@ -66,15 +66,15 @@ describe("correct behavior", () => {
|
|||
maximumFractionDigits: 0,
|
||||
});
|
||||
expect(en2.formatRangeToParts(2.9, 3.1)).toEqual([
|
||||
{ type: "approximatelySign", value: "~", source: "" },
|
||||
{ type: "currency", value: "$", source: "" },
|
||||
{ type: "integer", value: "3", source: "" },
|
||||
{ type: "approximatelySign", value: "~", source: "shared" },
|
||||
{ type: "currency", value: "$", source: "shared" },
|
||||
{ type: "integer", value: "3", source: "shared" },
|
||||
]);
|
||||
|
||||
const ja1 = new Intl.NumberFormat("ja", { maximumFractionDigits: 0 });
|
||||
expect(ja1.formatRangeToParts(2.9, 3.1)).toEqual([
|
||||
{ type: "approximatelySign", value: "約", source: "" },
|
||||
{ type: "integer", value: "3", source: "" },
|
||||
{ type: "approximatelySign", value: "約", source: "shared" },
|
||||
{ type: "integer", value: "3", source: "shared" },
|
||||
]);
|
||||
|
||||
const ja2 = new Intl.NumberFormat("ja", {
|
||||
|
@ -83,9 +83,9 @@ describe("correct behavior", () => {
|
|||
maximumFractionDigits: 0,
|
||||
});
|
||||
expect(ja2.formatRangeToParts(2.9, 3.1)).toEqual([
|
||||
{ type: "approximatelySign", value: "約", source: "" },
|
||||
{ type: "currency", value: "¥", source: "" },
|
||||
{ type: "integer", value: "3", source: "" },
|
||||
{ type: "approximatelySign", value: "約", source: "shared" },
|
||||
{ type: "currency", value: "¥", source: "shared" },
|
||||
{ type: "integer", value: "3", source: "shared" },
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue