| 1 |
// |reftest| skip-if(!Intl.hasOwnProperty('DurationFormat')) -- Intl.DurationFormat is not enabled unconditionally |
| 2 |
// Copyright 2022 Igalia, S.L. All rights reserved. |
| 3 |
// This code is governed by the BSD license found in the LICENSE file. |
| 4 |
|
| 5 |
/*--- |
| 6 |
esid: sec-Intl.DurationFormat |
| 7 |
description: Checks handling of valid options for the DurationFormat constructor. |
| 8 |
info: | |
| 9 |
Intl.DurationFormat ( [ locales [ , options ] ] ) |
| 10 |
(...) |
| 11 |
17. For each row in Table 1, except the header row, in table order, do |
| 12 |
a. Let styleSlot be the Style Slot value. |
| 13 |
b. Let displaySlot be the Display Slot value. |
| 14 |
c. Let unit be the Unit value. |
| 15 |
d. Let valueList be the Values value. |
| 16 |
e. Let digitalBase be the Digital Default value. |
| 17 |
f. Let unitOptions be ? GetUnitOptions(unit, options, style, valueList, digitalBase, prevStyle). |
| 18 |
g. Set durationFormat.[[<styleSlot>]] to unitOptions.[[Style]]. |
| 19 |
h. Set durationFormat.[[<displaySlot>]] to unitOptions.[[Display]]. |
| 20 |
features: [Intl.DurationFormat] |
| 21 |
includes: [testIntl.js] |
| 22 |
---*/ |
| 23 |
|
| 24 |
testOption( Intl.DurationFormat, "years", "string", ["long", "short", "narrow"], "short"); |
| 25 |
testOption( Intl.DurationFormat, "months", "string", ["long", "short", "narrow"], "short"); |
| 26 |
testOption( Intl.DurationFormat, "weeks", "string", ["long", "short", "narrow"], "short"); |
| 27 |
testOption( Intl.DurationFormat, "days", "string", ["long", "short", "narrow"], "short"); |
| 28 |
testOption( Intl.DurationFormat, "hours", "string", ["long", "short", "narrow", "numeric", "2-digit"], "short"); |
| 29 |
testOption( Intl.DurationFormat, "minutes", "string", ["long", "short", "narrow", "numeric", "2-digit"], "short"); |
| 30 |
testOption( Intl.DurationFormat, "seconds", "string", ["long", "short", "narrow", "numeric", "2-digit"], "short"); |
| 31 |
testOption( Intl.DurationFormat, "milliseconds", "string", ["long", "short", "narrow", "numeric"], "short"); |
| 32 |
testOption( Intl.DurationFormat, "microseconds", "string", ["long", "short", "narrow", "numeric"], "short"); |
| 33 |
testOption( Intl.DurationFormat, "nanoseconds", "string", ["long", "short", "narrow", "numeric"], "short"); |
| 34 |
|
| 35 |
|
| 36 |
reportCompare(0, 0); |