summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/DurationFormat
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /js/src/tests/test262/intl402/DurationFormat
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/intl402/DurationFormat')
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/constructor-unit-style-defaults.js34
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/fractions-of-subsecond-units-en.js65
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-non-numeric-styles-es.js88
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-short-and-numeric.js37
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-default-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-short-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-digital-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-long-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-narrow-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/numeric-hour-with-zero-minutes-and-non-zero-seconds.js20
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/precision-exact-mathematical-values.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/style-default-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-en.js (renamed from js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits.js)13
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-undefined-en.js (renamed from js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-undefined.js)17
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/style-long-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/style-narrow-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/format/style-short-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-default-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-digital-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-long-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-narrow-en.js2
-rw-r--r--js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-short-en.js2
23 files changed, 264 insertions, 42 deletions
diff --git a/js/src/tests/test262/intl402/DurationFormat/constructor-unit-style-defaults.js b/js/src/tests/test262/intl402/DurationFormat/constructor-unit-style-defaults.js
new file mode 100644
index 0000000000..93f54dcab4
--- /dev/null
+++ b/js/src/tests/test262/intl402/DurationFormat/constructor-unit-style-defaults.js
@@ -0,0 +1,34 @@
+// |reftest| skip -- Intl.DurationFormat is not supported
+// Copyright 2024 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DurationFormat
+description: Verifies that default style settings for units following units with "numeric" or "2-digit" style are honored.
+info: |
+ GetDurationUnitOptions (unit, options, baseStyle, stylesList, digitalBase, prevStyle)
+ (...)
+ 3. If style is undefined, then
+ (...)
+ i. If prevStyle is "fractional", "numeric" or "2-digit", then
+ (...)
+ 2. Set style to "numeric".
+ (...)
+ 9. If prevStyle is "numeric" or "2-digit", then
+ (...)
+ b. If unit is "minutes" or "seconds", then
+ i. Set style to "2-digit".
+features: [Intl.DurationFormat]
+---*/
+
+for (const numericLikeStyle of ["numeric", "2-digit"]){
+ var opts = new Intl.DurationFormat([], {hours: numericLikeStyle}).resolvedOptions();
+
+ assert.sameValue(opts.minutes, "2-digit", `minutes default value should be '2-digit' when following any ${numericLikeStyle}-styled unit`);
+ assert.sameValue(opts.seconds, "2-digit", `seconds default value should be '2-digit' when following any ${numericLikeStyle}-styled unit`);
+ assert.sameValue(opts.milliseconds, "numeric", `milliseconds default value should be 'numeric' when following any ${numericLikeStyle}-styled unit`);
+ assert.sameValue(opts.microseconds, "numeric", `microseconds default value should be 'numeric' when following any ${numericLikeStyle}-styled unit`);
+ assert.sameValue(opts.nanoseconds, "numeric", `nanoseconds default value should be 'numeric' when following any ${numericLikeStyle}-styled unit`);
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/fractions-of-subsecond-units-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/fractions-of-subsecond-units-en.js
new file mode 100644
index 0000000000..342fa613cf
--- /dev/null
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/fractions-of-subsecond-units-en.js
@@ -0,0 +1,65 @@
+// |reftest| skip -- Intl.DurationFormat is not supported
+// Copyright (C) 2024 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DurationFormat.prototype.format
+description: Checks that fractional milliseconds and microseconds are formatted correctly when microseconds or nanoseconds are the first units with "numeric" style.
+info: |
+ PartitionDurationFormatPattern ( durationFormat, duration )
+ (...)
+ 9.
+ (...)
+ g. If unit is "seconds", "milliseconds", or "microseconds", then
+ i. If unit is "seconds", then
+ 1. Let nextStyle be durationFormat.[[MillisecondsStyle]].
+ ii. Else if unit is "milliseconds", then
+ 1. Let nextStyle be durationFormat.[[MicrosecondsStyle]].
+ iii. Else,
+ 1. Let nextStyle be durationFormat.[[NanosecondsStyle]].
+ iv. If nextStyle is "fractional", then
+ 1. Set value to value + AddFractionalDigits(durationFormat, duration).
+ 2. If durationFormat.[[FractionalDigits]] is undefined, then
+ a. Let maximumFractionDigits be 9𝔽.
+ b. Let minimumFractionDigits be +0𝔽.
+ 3. Else,
+ a. Let maximumFractionDigits be 𝔽(durationFormat.[[FractionalDigits]]).
+ b. Let minimumFractionDigits be 𝔽(durationFormat.[[FractionalDigits]]).
+ 4. Perform ! CreateDataPropertyOrThrow(nfOpts, "maximumFractionDigits", maximumFractionDigits ).
+ 5. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumFractionDigits", minimumFractionDigits ).
+ 6. Perform ! CreateDataPropertyOrThrow(nfOpts, "roundingMode", "trunc").
+ 7. Set done to true.
+
+locale: [en]
+features: [Intl.DurationFormat]
+---*/
+
+
+const locale = "en";
+const decimalSeparator = ".";
+
+let d = {seconds: 3, milliseconds: 444, microseconds: 55, nanoseconds: 6};
+let dfOpts = {microseconds: "numeric"};
+
+let expectedList = [];
+expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "second", unitDisplay: "short"}).format(d.seconds));
+expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "millisecond", unitDisplay: "short", minimumFractionDigits:0, maximumFractionDigits: 9}).format(d.milliseconds.toString() + decimalSeparator + d.microseconds.toString().padStart(3, '0') + d.nanoseconds.toString().padStart(3, '0')));
+
+let expected = new Intl.ListFormat(locale, {style: "short"}).format(expectedList);
+let actual = new Intl.DurationFormat(locale, dfOpts).format(d);
+
+// assert.sameValue(actual, expected, `DurationFormat output when microseconds first "numeric" unit`);
+
+dfOpts = {nanoseconds: "numeric"};
+expectedList = [];
+
+expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "second", unitDisplay: "short"}).format(d.seconds));
+expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "millisecond", unitDisplay: "short"}).format(d.milliseconds));
+expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "microsecond", unitDisplay: "short", minimumFractionDigits:0, maximumFractionDigits: 9}).format(d.microseconds.toString() + decimalSeparator + d.nanoseconds.toString().padStart(3, '0')));
+
+expected = new Intl.ListFormat(locale, {style: "short"}).format(expectedList);
+actual = new Intl.DurationFormat(locale, dfOpts).format(d);
+
+assert.sameValue(actual, expected, `DurationFormat output when nanoseconds first "numeric" unit`);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-non-numeric-styles-es.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-non-numeric-styles-es.js
new file mode 100644
index 0000000000..33ec1a2776
--- /dev/null
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-non-numeric-styles-es.js
@@ -0,0 +1,88 @@
+// |reftest| skip -- Intl.DurationFormat is not supported
+// Copyright 2024 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DurationFormat.prototype.format
+description: Test if format method formats duration correctly with mixed non-numeric settings for unit styles. Compares output from format method to output produced through using NumberFormat and ListFormat as used by DurationFormat.
+info: |
+ PartitionDurationFormatPattern ( durationFormat, duration )
+ ...
+ 9. While done is false, repeat for each row in Table 2 in table order, except the header row:
+ ...
+ k. If value is not 0 or display is not "auto" or displayRequired is "true", then
+ ...
+ v. If style is not "fractional", "numeric", or "2-digit", then
+ 1. Perform ! CreateDataPropertyOrThrow(nfOpts, "style", "unit").
+ 2. Perform ! CreateDataPropertyOrThrow(nfOpts, "unit", numberFormatUnit).
+ 3. Perform ! CreateDataPropertyOrThrow(nfOpts, "unitDisplay", style).
+ ...
+ ix. Let parts be ! PartitionNumberPattern(nf, value).
+ ...
+ 14. Perform ! CreateDataPropertyOrThrow(lfOpts, "style", listStyle).
+ 15. Let lf be ! Construct(%ListFormat%, « durationFormat.[[Locale]], lfOpts »).
+ ...
+ 18. Let formatted be CreatePartsFromList(lf, strings).
+
+locale: [es]
+features: [Intl.DurationFormat]
+---*/
+
+function formatDuration(locale, duration, dfOpts){
+ let result = [];
+ for (const unit in duration){
+ let nfUnit = unit.substring(0, unit.length - 1);
+ let nf = new Intl.NumberFormat(locale, {style: "unit", unit: nfUnit, unitDisplay: dfOpts[unit]});
+ result.push(nf.format(duration[unit]));
+ }
+
+ for (const baseStyle of ["long", "short", "narrow"]){
+ let lf = new Intl.ListFormat(locale, {type: "unit", style: baseStyle});
+ let expected = lf.format(result);
+ dfOpts.style = baseStyle;
+ let df = new Intl.DurationFormat(locale, dfOpts);
+ let actual = df.format(duration);
+ assert.sameValue(actual, expected);
+ }
+}
+
+const duration = {
+ years: 1,
+ months: 2,
+ weeks: 3,
+ days: 0,
+ hours: 4,
+ minutes: 5,
+ seconds: 6,
+ milliseconds: 7,
+ microseconds: 8,
+ nanoseconds: 9,
+};
+
+const locale = "es";
+
+formatDuration(locale, duration, {
+ years: "narrow",
+ months: "narrow",
+ weeks: "narrow",
+ days: "short",
+ hours: "short",
+ minutes: "short",
+ seconds: "long",
+ milliseconds: "long",
+ microseconds: "long",
+ nanoseconds: "narrow", });
+
+formatDuration(locale, duration, {
+ years: "long",
+ months: "short",
+ weeks: "narrow",
+ days: "long",
+ hours: "short",
+ minutes: "narrow",
+ seconds: "long",
+ milliseconds: "short",
+ microseconds: "narrow",
+ nanoseconds: "long", });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-short-and-numeric.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-short-and-numeric.js
new file mode 100644
index 0000000000..19adbfbd47
--- /dev/null
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/mixed-short-and-numeric.js
@@ -0,0 +1,37 @@
+// |reftest| skip -- Intl.DurationFormat is not supported
+// Copyright (C) 2024 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-Intl.DurationFormat.prototype.format
+description: Checks that durations containing a mixture of numericlike and non-numericlike styles are formatted using the "short" style when DurationFormat base style is *undefined*.
+info: |
+ PartitionDurationFormatPattern ( durationFormat, duration )
+
+ 12. Let listStyle be durationFormat.[[Style]].
+ (...)
+ 14. Perform ! CreateDataPropertyOrThrow(lfOpts, "style", listStyle).
+
+locale: [en]
+features: [Intl.DurationFormat]
+---*/
+
+const locale = "en";
+const timeSeparator = ":";
+
+
+let d = {days: 5, hours: 1, minutes: 2, seconds: 3};
+let dfOpts = {minutes: "numeric", seconds: "numeric"};
+
+let expectedList = [];
+expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "day", unitDisplay: "short"}).format(d.days));
+expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "hour", unitDisplay: "short"}).format(d.hours));
+expectedList.push(new Intl.NumberFormat(locale).format(d.minutes) + timeSeparator + new Intl.NumberFormat(locale, {minimumIntegerDigits: 2}).format(d.seconds));
+
+let expected = new Intl.ListFormat(locale, {style: "short"}).format(expectedList);
+let actual = new Intl.DurationFormat(locale, dfOpts).format(d);
+
+assert.sameValue(actual, expected);
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-default-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-default-en.js
index c6b58a5dfc..3c0f1d6dd5 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-default-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-default-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.format
description: >
Test format method with negative duration and default style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-short-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-short-en.js
index 83eb5b4639..9ebf996341 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-short-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-duration-style-short-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.format
description: >
Test format method with negative duration and "short" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-digital-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-digital-en.js
index c9f119c368..e26f198cd5 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-digital-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-digital-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.format
description: >
Test format method with negative duration and "digital" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-long-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-long-en.js
index fe074d488e..d7654f5630 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-long-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-long-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.format
description: >
Test format method with negative duration and "long" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-narrow-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-narrow-en.js
index 4d1db5dc67..1735112336 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-narrow-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/negative-durationstyle-narrow-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.format
description: >
Test format method with negative duration and "narrow" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/numeric-hour-with-zero-minutes-and-non-zero-seconds.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/numeric-hour-with-zero-minutes-and-non-zero-seconds.js
index dc5ad4ea84..3c37afa1b4 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/numeric-hour-with-zero-minutes-and-non-zero-seconds.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/numeric-hour-with-zero-minutes-and-non-zero-seconds.js
@@ -5,8 +5,8 @@
/*---
esid: sec-Intl.DurationFormat.prototype.format
description: >
- The correct separator is used for numeric hours with zero minutes and non-zero seconds.
-locale: [en-US]
+ Minutes with numeric or 2-digit style are included in the output when between displayed hours and seconds, even when the minutes value is zero.
+locale: [en]
features: [Intl.DurationFormat]
---*/
@@ -15,30 +15,18 @@ const df = new Intl.DurationFormat("en", {
hours: "numeric",
});
-const lf = new Intl.ListFormat("en", {
- type: "unit",
- style: "short",
-});
-
const duration = {
hours: 1,
-
- // Minutes is omitted from the output when its value is zero.
minutes: 0,
-
- // Either seconds or sub-seconds must be non-zero.
seconds: 3,
};
-const expected = lf.format([
- new Intl.NumberFormat("en", {minimumIntegerDigits: 1}).format(duration.hours),
- new Intl.NumberFormat("en", {minimumIntegerDigits: 2}).format(duration.seconds),
-]);
+const expected = "1:00:03"
assert.sameValue(
df.format(duration),
expected,
- `No time separator is used when minutes is zero`
+ `Minutes always displayed when between displayed hours and seconds, even if minutes is 0`
);
reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/precision-exact-mathematical-values.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/precision-exact-mathematical-values.js
index 5518450d6a..dbb34d39f7 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/precision-exact-mathematical-values.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/precision-exact-mathematical-values.js
@@ -25,7 +25,7 @@ info: |
7. Let parts be ! PartitionNumberPattern(nf, value).
...
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-default-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-default-en.js
index 6eb5c4999e..dae05ae5f1 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-default-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-default-en.js
@@ -5,7 +5,7 @@
/*---
esid: sec-Intl.DurationFormat.prototype.format
description: Test if format method formats duration correctly with different "style" arguments
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-en.js
index 4f34d50aa9..cc2dd3342f 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-en.js
@@ -6,7 +6,7 @@
/*---
esid: sec-Intl.DurationFormat.prototype.format
description: Test if format method formats duration correctly with different "style" arguments
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-en.js
index d75f51b14a..60c2232d6a 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-en.js
@@ -14,6 +14,7 @@ info: |
5. Else,
a. Perform ! CreateDataPropertyOrThrow(nfOpts, "maximumFractionDigits", durationFormat.[[FractionalDigits]]).
b. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumFractionDigits", durationFormat.[[FractionalDigits]]).
+locale: [en]
features: [Intl.DurationFormat]
---*/
@@ -28,12 +29,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`);
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-undefined.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-undefined-en.js
index 631e6c36eb..b297c0c7ba 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-undefined.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-digital-fractionalDigits-undefined-en.js
@@ -14,6 +14,7 @@ info: |
5. Else,
a. Perform ! CreateDataPropertyOrThrow(nfOpts, "maximumFractionDigits", durationFormat.[[FractionalDigits]]).
b. Perform ! CreateDataPropertyOrThrow(nfOpts, "minimumFractionDigits", durationFormat.[[FractionalDigits]]).
+locale: [en]
features: [Intl.DurationFormat]
---*/
@@ -35,7 +36,7 @@ const durationMicro = {
microseconds: 222
};
-const durationMill = {
+const durationMilli = {
hours: 1,
minutes: 22,
seconds: 33,
@@ -48,6 +49,14 @@ const durationNoSubsecond = {
seconds: 33
};
+const durationFiveFractional = {
+ hours: 2,
+ minutes: 30,
+ seconds: 10,
+ milliseconds: 111,
+ microseconds: 220,
+};
+
const durationSevenFractional = {
hours: 2,
minutes: 30,
@@ -58,14 +67,14 @@ 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`);
assert.sameValue(df.format(durationMilli), "1:22:33.111", `format output with millisecond digits and fractionalDigits: undefined using ${style} style option`);
assert.sameValue(df.format(durationNoSubsecond), "1:22:33", `format output with no subsecond digits and fractionalDigits: undefined using ${style} style option`);
-assert.sameValue(df.format(durationFiveFractional), "2:30:11122", `format output with five subsecond digits and fractionalDigits: undefined using ${style} style option`);
-assert.sameValue(df.format(durationSevenFractional), "2:30:1112203", `format output with seven subsecond digits and fractionalDigits: undefined using ${style} style option`);
+assert.sameValue(df.format(durationFiveFractional), "2:30:10.11122", `format output with five subsecond digits and fractionalDigits: undefined using ${style} style option`);
+assert.sameValue(df.format(durationSevenFractional), "2:30:10.1112203", `format output with seven subsecond digits and fractionalDigits: undefined using ${style} style option`);
reportCompare(0, 0);
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-long-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-long-en.js
index d9e6fc6cbb..74524da674 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-long-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-long-en.js
@@ -5,7 +5,7 @@
/*---
esid: sec-Intl.DurationFormat.prototype.format
description: Test if format method formats duration correctly with different "style" arguments
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-narrow-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-narrow-en.js
index 66b2258761..e75dc17170 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-narrow-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-narrow-en.js
@@ -5,7 +5,7 @@
/*---
esid: sec-Intl.DurationFormat.prototype.format
description: Test if format method formats duration correctly with different "style" arguments
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-short-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-short-en.js
index 2a66c01b06..049e034681 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-short-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/format/style-short-en.js
@@ -5,7 +5,7 @@
/*---
esid: sec-Intl.DurationFormat.prototype.format
description: Test if format method formats duration correctly with different "style" arguments
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-default-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-default-en.js
index bfc182c34b..5ce6300268 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-default-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-default-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.formatToParts
description: >
Test formatToParts method with negative duration and default style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-digital-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-digital-en.js
index 52a40072ba..6978739ac3 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-digital-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-digital-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.formatToParts
description: >
Test formatToParts method with negative duration and "digital" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-long-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-long-en.js
index 3756db8a84..638f5922f1 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-long-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-long-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.formatToParts
description: >
Test formatToParts method with negative duration and "long" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-narrow-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-narrow-en.js
index a9717ce67a..b138100f8a 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-narrow-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-narrow-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.formatToParts
description: >
Test formatToParts method with negative duration and "narrow" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/
diff --git a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-short-en.js b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-short-en.js
index bc2ed69c5b..76ce8ccbf1 100644
--- a/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-short-en.js
+++ b/js/src/tests/test262/intl402/DurationFormat/prototype/formatToParts/negative-duration-formatToParts-style-short-en.js
@@ -6,7 +6,7 @@
esid: sec-Intl.DurationFormat.prototype.formatToParts
description: >
Test formatToParts method with negative duration and "short" style
-locale: [en-US]
+locale: [en]
includes: [testIntl.js]
features: [Intl.DurationFormat]
---*/