diff options
author | Timothy Flynn <trflynn89@pm.me> | 2021-12-10 13:21:44 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-12-10 21:27:24 +0000 |
commit | 07c5419a823cdf7be394c4c96088293e53c4ed32 (patch) | |
tree | 6cbaa9c6f85cacc27cf906d555e8de370919a81d | |
parent | 5bdee9e38a2ed404fe0b6b03a4c7f30560ba7b5f (diff) | |
download | serenity-07c5419a823cdf7be394c4c96088293e53c4ed32.zip |
LibJS: Add test case for locales which do not define day periods
Some locales do not define morning, night, etc. day period ranges.
TR-35 states they should fall back to the fixed day periods AM and PM.
Add a test case for the "as" locale, which is one such locale, to ensure
its AM/PM symbols are used.
-rw-r--r-- | Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js index 368a6fd5e6..fda51cb721 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.format.js @@ -229,9 +229,9 @@ describe("day", () => { describe("dayPeriod", () => { // prettier-ignore const data = [ - { dayPeriod: "narrow", en0: "5 in the afternoon", en1: "7 in the morning", ar0: "٥ بعد الظهر", ar1: "٧ صباحًا" }, - { dayPeriod: "short", en0: "5 in the afternoon", en1: "7 in the morning", ar0: "٥ بعد الظهر", ar1: "٧ ص" }, - { dayPeriod: "long", en0: "5 in the afternoon", en1: "7 in the morning", ar0: "٥ بعد الظهر", ar1: "٧ صباحًا" }, + { dayPeriod: "narrow", en0: "5 in the afternoon", en1: "7 in the morning", ar0: "٥ بعد الظهر", ar1: "٧ صباحًا", as0: "অপৰাহ্ন ৫", as1: "পূৰ্বাহ্ন ৭"}, + { dayPeriod: "short", en0: "5 in the afternoon", en1: "7 in the morning", ar0: "٥ بعد الظهر", ar1: "٧ ص", as0: "অপৰাহ্ন ৫", as1: "পূৰ্বাহ্ন ৭"}, + { dayPeriod: "long", en0: "5 in the afternoon", en1: "7 in the morning", ar0: "٥ بعد الظهر", ar1: "٧ صباحًا", as0: "অপৰাহ্ন ৫", as1: "পূৰ্বাহ্ন ৭"}, ]; test("all", () => { @@ -251,6 +251,14 @@ describe("dayPeriod", () => { }); expect(ar.format(d0)).toBe(d.ar0); expect(ar.format(d1)).toBe(d.ar1); + + const as = new Intl.DateTimeFormat("as", { + dayPeriod: d.dayPeriod, + hour: "numeric", + timeZone: "UTC", + }); + expect(as.format(d0)).toBe(d.as0); + expect(as.format(d1)).toBe(d.as1); }); }); }); |