Skip to content

Commit

Permalink
Two tests previously assumed 'en' as locale for DurationFormat, assum…
Browse files Browse the repository at this point in the history
…ption now made explicit (#4019)
  • Loading branch information
ben-allen authored Mar 15, 2024
1 parent af3890a commit 0b1abd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ info: |
5. Else,
a. Perform ! CreateDataPropertyOrThrow(nfOpts, "maximumFractionDigits", durationFormat.[[FractionalDigits]]).
b. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumFractionDigits", durationFormat.[[FractionalDigits]]).
locale: [en-US]
features: [Intl.DurationFormat]
---*/

Expand All @@ -27,12 +28,12 @@ const duration = {


const style = "digital";
const df = new Intl.DurationFormat(undefined, {style, fractionalDigits: 0});
const dfMilli = new Intl.DurationFormat(undefined, {style, fractionalDigits: 3});
const dfFourDigits = new Intl.DurationFormat(undefined, {style, fractionalDigits: 4});
const dfMicro = new Intl.DurationFormat(undefined, {style, fractionalDigits: 6});
const dfEightDigits = new Intl.DurationFormat(undefined, {style, fractionalDigits: 8});
const dfNano = new Intl.DurationFormat(undefined, {style, fractionalDigits: 9});
const df = new Intl.DurationFormat("en", {style, fractionalDigits: 0});
const dfMilli = new Intl.DurationFormat("en", {style, fractionalDigits: 3});
const dfFourDigits = new Intl.DurationFormat("en", {style, fractionalDigits: 4});
const dfMicro = new Intl.DurationFormat("en", {style, fractionalDigits: 6});
const dfEightDigits = new Intl.DurationFormat("en", {style, fractionalDigits: 8});
const dfNano = new Intl.DurationFormat("en", {style, fractionalDigits: 9});

assert.sameValue(df.format(duration), "1:22:33", `format output without sub-second digits using ${style} style option`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ info: |
5. Else,
a. Perform ! CreateDataPropertyOrThrow(nfOpts, "maximumFractionDigits", durationFormat.[[FractionalDigits]]).
b. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumFractionDigits", durationFormat.[[FractionalDigits]]).
locale: [en-US]
features: [Intl.DurationFormat]
---*/

Expand Down Expand Up @@ -57,7 +58,7 @@ const durationSevenFractional = {
};

const style = "digital";
const df = new Intl.DurationFormat(undefined, {style, fractionalDigits: undefined});
const df = new Intl.DurationFormat("en", {style, fractionalDigits: undefined});

assert.sameValue(df.format(durationNano), "1:22:33.111222333", `format output with nanosecond digits and fractionalDigits: undefined using ${style} style option`);
assert.sameValue(df.format(durationMicro), "1:22:33.111222", `format output with microsecond digits and fractionalDigits: undefined using ${style} style option`);
Expand Down

0 comments on commit 0b1abd5

Please sign in to comment.