throws-for-minimumFractionDigits-over-limit.js (860B)
1 // Copyright 2023 Google Inc. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-initializenumberformat 6 description: > 7 Tests that the options minimumFractionDigits limit to the range 0 - 100. 8 info: | 9 InitializeNumberFormat ( numberFormat, locales, options ) 10 11 25.a.ii. Set mxfd to ? DefaultNumberOption(mxfd, 0, 100, undefined). 12 13 DefaultNumberOption ( value, minimum, maximum, fallback ) 14 15 3. If value is NaN or less than minimum or greater than maximum, throw a RangeError exception. 16 ---*/ 17 18 let wontThrow = new Intl.NumberFormat(undefined, {minimumFractionDigits: 100}); 19 20 assert.throws(RangeError, function () { 21 return new Intl.NumberFormat(undefined, {minimumFractionDigits: 101}); 22 }, "Throws RangeError when minimumFractionDigits is more than 100."); 23 24 reportCompare(0, 0);