mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibJS: Ensure tests using the "ar" locale use the "arab" number system
In ICU 76, the default was changed from "arab" to "latn". See:
c149724509
The whole point of these tests was to use a non-Latin numbering system.
This patch ensures that is the case to make following patches easier to
grok.
This commit is contained in:
parent
96558b98f9
commit
0763997591
Notes:
github-actions[bot]
2025-01-18 22:57:49 +00:00
Author: https://github.com/trflynn89
Commit: 0763997591
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3295
Reviewed-by: https://github.com/shannonbooth ✅
11 changed files with 286 additions and 179 deletions
|
@ -40,8 +40,8 @@ describe("correct behavior", () => {
|
|||
expect(d0.toLocaleDateString("en", { timeZone: "UTC" })).toBe("12/7/2021");
|
||||
expect(d1.toLocaleDateString("en", { timeZone: "UTC" })).toBe("1/23/1989");
|
||||
|
||||
expect(d0.toLocaleDateString("ar", { timeZone: "UTC" })).toBe("٧/١٢/٢٠٢١");
|
||||
expect(d1.toLocaleDateString("ar", { timeZone: "UTC" })).toBe("٢٣/١/١٩٨٩");
|
||||
expect(d0.toLocaleDateString("ar-u-nu-arab", { timeZone: "UTC" })).toBe("٧/١٢/٢٠٢١");
|
||||
expect(d1.toLocaleDateString("ar-u-nu-arab", { timeZone: "UTC" })).toBe("٢٣/١/١٩٨٩");
|
||||
});
|
||||
|
||||
test("dateStyle may be set", () => {
|
||||
|
@ -52,10 +52,10 @@ describe("correct behavior", () => {
|
|||
"Monday, January 23, 1989"
|
||||
);
|
||||
|
||||
expect(d0.toLocaleDateString("ar", { dateStyle: "full", timeZone: "UTC" })).toBe(
|
||||
expect(d0.toLocaleDateString("ar-u-nu-arab", { dateStyle: "full", timeZone: "UTC" })).toBe(
|
||||
"الثلاثاء، ٧ ديسمبر ٢٠٢١"
|
||||
);
|
||||
expect(d1.toLocaleDateString("ar", { dateStyle: "full", timeZone: "UTC" })).toBe(
|
||||
expect(d1.toLocaleDateString("ar-u-nu-arab", { dateStyle: "full", timeZone: "UTC" })).toBe(
|
||||
"الاثنين، ٢٣ يناير ١٩٨٩"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -34,18 +34,22 @@ describe("correct behavior", () => {
|
|||
expect(d0.toLocaleString("en", { timeZone: "UTC" })).toBe("12/7/2021, 5:40:50 PM");
|
||||
expect(d1.toLocaleString("en", { timeZone: "UTC" })).toBe("1/23/1989, 7:08:09 AM");
|
||||
|
||||
expect(d0.toLocaleString("ar", { timeZone: "UTC" })).toBe("٧/١٢/٢٠٢١، ٥:٤٠:٥٠ م");
|
||||
expect(d1.toLocaleString("ar", { timeZone: "UTC" })).toBe("٢٣/١/١٩٨٩، ٧:٠٨:٠٩ ص");
|
||||
expect(d0.toLocaleString("ar-u-nu-arab", { timeZone: "UTC" })).toBe(
|
||||
"٧/١٢/٢٠٢١، ٥:٤٠:٥٠ م"
|
||||
);
|
||||
expect(d1.toLocaleString("ar-u-nu-arab", { timeZone: "UTC" })).toBe(
|
||||
"٢٣/١/١٩٨٩، ٧:٠٨:٠٩ ص"
|
||||
);
|
||||
});
|
||||
|
||||
test("dateStyle may be set", () => {
|
||||
expect(d0.toLocaleString("en", { dateStyle: "short", timeZone: "UTC" })).toBe("12/7/21");
|
||||
expect(d1.toLocaleString("en", { dateStyle: "short", timeZone: "UTC" })).toBe("1/23/89");
|
||||
|
||||
expect(d0.toLocaleString("ar", { dateStyle: "short", timeZone: "UTC" })).toBe(
|
||||
expect(d0.toLocaleString("ar-u-nu-arab", { dateStyle: "short", timeZone: "UTC" })).toBe(
|
||||
"٧/١٢/٢٠٢١"
|
||||
);
|
||||
expect(d1.toLocaleString("ar", { dateStyle: "short", timeZone: "UTC" })).toBe(
|
||||
expect(d1.toLocaleString("ar-u-nu-arab", { dateStyle: "short", timeZone: "UTC" })).toBe(
|
||||
"٢٣/١/١٩٨٩"
|
||||
);
|
||||
});
|
||||
|
@ -54,7 +58,11 @@ describe("correct behavior", () => {
|
|||
expect(d0.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe("5:40 PM");
|
||||
expect(d1.toLocaleString("en", { timeStyle: "short", timeZone: "UTC" })).toBe("7:08 AM");
|
||||
|
||||
expect(d0.toLocaleString("ar", { timeStyle: "short", timeZone: "UTC" })).toBe("٥:٤٠ م");
|
||||
expect(d1.toLocaleString("ar", { timeStyle: "short", timeZone: "UTC" })).toBe("٧:٠٨ ص");
|
||||
expect(d0.toLocaleString("ar-u-nu-arab", { timeStyle: "short", timeZone: "UTC" })).toBe(
|
||||
"٥:٤٠ م"
|
||||
);
|
||||
expect(d1.toLocaleString("ar-u-nu-arab", { timeStyle: "short", timeZone: "UTC" })).toBe(
|
||||
"٧:٠٨ ص"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -40,8 +40,8 @@ describe("correct behavior", () => {
|
|||
expect(d0.toLocaleTimeString("en", { timeZone: "UTC" })).toBe("5:40:50 PM");
|
||||
expect(d1.toLocaleTimeString("en", { timeZone: "UTC" })).toBe("7:08:09 AM");
|
||||
|
||||
expect(d0.toLocaleTimeString("ar", { timeZone: "UTC" })).toBe("٥:٤٠:٥٠ م");
|
||||
expect(d1.toLocaleTimeString("ar", { timeZone: "UTC" })).toBe("٧:٠٨:٠٩ ص");
|
||||
expect(d0.toLocaleTimeString("ar-u-nu-arab", { timeZone: "UTC" })).toBe("٥:٤٠:٥٠ م");
|
||||
expect(d1.toLocaleTimeString("ar-u-nu-arab", { timeZone: "UTC" })).toBe("٧:٠٨:٠٩ ص");
|
||||
});
|
||||
|
||||
test("timeStyle may be set", () => {
|
||||
|
@ -52,10 +52,10 @@ describe("correct behavior", () => {
|
|||
"7:08:09 AM UTC"
|
||||
);
|
||||
|
||||
expect(d0.toLocaleTimeString("ar", { timeStyle: "long", timeZone: "UTC" })).toBe(
|
||||
expect(d0.toLocaleTimeString("ar-u-nu-arab", { timeStyle: "long", timeZone: "UTC" })).toBe(
|
||||
"٥:٤٠:٥٠ م UTC"
|
||||
);
|
||||
expect(d1.toLocaleTimeString("ar", { timeStyle: "long", timeZone: "UTC" })).toBe(
|
||||
expect(d1.toLocaleTimeString("ar-u-nu-arab", { timeStyle: "long", timeZone: "UTC" })).toBe(
|
||||
"٧:٠٨:٠٩ ص UTC"
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue