summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-12-06 22:50:54 -0500
committerLinus Groh <mail@linusgroh.de>2021-12-08 11:29:36 +0000
commit9f7c7277201df5649a6b229d73e2273835b873ff (patch)
treeb343bd7f64ac9a8201976ecbb2d5100906046a58 /Userland/Libraries/LibJS/Tests
parent6ace4000bf9127c43fe1ce4c5c49015e0467deaa (diff)
downloadserenity-9f7c7277201df5649a6b229d73e2273835b873ff.zip
LibJS+LibUnicode: Generate missing patterns with fractionalSecondDigits
TR-35's Matching Skeleton algorithm dictates how user requests including fractional second digits should be handled when the CLDR format pattern does not include that field. When the format pattern contains {second}, but does not contain {fractionalSecondDigits}, generate a second pattern which appends "{decimal}{fractionalSecondDigits}" to the {second} field.
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js
index cb9ff39372..da70832e14 100644
--- a/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js
+++ b/Userland/Libraries/LibJS/Tests/builtins/Intl/DateTimeFormat/DateTimeFormat.prototype.resolvedOptions.js
@@ -1,6 +1,3 @@
-// NOTE: We cannot yet test the fractionalSecondDigits option. There aren't any patterns in the CLDR
-// with this field ('S' in https://unicode.org/reports/tr35/tr35-dates.html#dfst-second). We
-// will need to figure out how this field should be generated.
describe("correct behavior", () => {
test("length is 0", () => {
expect(Intl.DateTimeFormat.prototype.resolvedOptions).toHaveLength(0);
@@ -179,6 +176,15 @@ describe("correct behavior", () => {
});
});
+ test("fractionalSecondDigits", () => {
+ [1, 2, 3].forEach(fractionalSecondDigits => {
+ const en = new Intl.DateTimeFormat("en", {
+ fractionalSecondDigits: fractionalSecondDigits,
+ });
+ expect(en.resolvedOptions().fractionalSecondDigits).toBe(fractionalSecondDigits);
+ });
+ });
+
test("timeZoneName", () => {
["short", "long"].forEach(timeZoneName => {
const en = new Intl.DateTimeFormat("en", { timeZoneName: timeZoneName });