tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

throws-for-minimumFractionDigits-under-limit.js (855B)


      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: 0});
     19 
     20 assert.throws(RangeError, function () {
     21        return new Intl.NumberFormat(undefined, {minimumFractionDigits: -1});
     22 }, "Throws RangeError when minimumFractionDigits is less than 0.");
     23 
     24 reportCompare(0, 0);