constructor-options-fractionalDigits-invalid.js (775B)
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 invalidOptions = [ 15 -10, 16 10 17 ]; 18 19 for (const fractionalDigits of invalidOptions) { 20 assert.throws(RangeError, function() { 21 new Intl.DurationFormat("en", { fractionalDigits }); 22 }, `new Intl.DurationFormat("en", {fractionalDigits: "${fractionalDigits}"}) throws RangeError`); 23 } 24 25 reportCompare(0, 0);