Debian Codegraph @

js/src/tests/test262/intl402/DurationFormat/constructor-options-fractionalDigits-valid.js

raw
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: Tests that the option fractionalDigits is processed correctly.
8 info: |
9 Intl.DurationFormat ( [ locales [ , options ] ] )
10 (...)
11 18. Set durationFormat.[[FractionalDigits]] to ? GetNumberOption(options, "fractionalDigits", 0, 9, undefined).
12 features: [Intl.DurationFormat]
13 ---*/
14
15 const validOptions = [
16 0,
17 1,
18 5,
19 9,
20 undefined
21 ];
22
23 for (const fractionalDigits of validOptions) {
24 const obj = new Intl.DurationFormat("en", {fractionalDigits});
25 assert.sameValue(obj.resolvedOptions().fractionalDigits, fractionalDigits, `${fractionalDigits} is supported by DurationFormat`);
26 }
27
28 reportCompare(0, 0);