constructor-options-fractionalDigits-valid.js (790B)
1 // Copyright 2022 Igalia, S.L. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-Intl.DurationFormat 6 description: Tests that the option fractionalDigits is processed correctly. 7 info: | 8 Intl.DurationFormat ( [ locales [ , options ] ] ) 9 (...) 10 18. Set durationFormat.[[FractionalDigits]] to ? GetNumberOption(options, "fractionalDigits", 0, 9, undefined). 11 features: [Intl.DurationFormat] 12 ---*/ 13 14 const validOptions = [ 15 0, 16 1, 17 5, 18 9, 19 undefined 20 ]; 21 22 for (const fractionalDigits of validOptions) { 23 const obj = new Intl.DurationFormat("en", {fractionalDigits}); 24 assert.sameValue(obj.resolvedOptions().fractionalDigits, fractionalDigits, `${fractionalDigits} is supported by DurationFormat`); 25 } 26 27 reportCompare(0, 0);