mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
ISO 4217 no longer normative for currency minor digits. New test verifies that currency data (from whatever source) is used by verifying that `maximumFractionDigits` and `minimumFractionDigits` are identical. See https://github.com/tc39/ecma402/pull/922
24 lines
891 B
JavaScript
24 lines
891 B
JavaScript
// Copyright 2024 Igalia S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
esid: sec-intl.numberformat
|
|
description: >
|
|
Tests that data for the number of fractional digits when formatting currency is used.
|
|
info: |
|
|
15.1.1 Intl.NumberFormat ([ locales [ , options ]])
|
|
|
|
19. If style is "currency" and "notation" is "standard", then
|
|
a. Let currency be numberFormat.[[Currency]].
|
|
b. Let cDigits be CurrencyDigits(currency).
|
|
c. Let mnfdDefault be cDigits.
|
|
d. Let mxfdDefault be cDigits.
|
|
author: Ben Allen
|
|
---*/
|
|
|
|
const nf = Intl.NumberFormat([], {style: "currency", currency: "USD"});
|
|
const max = nf.resolvedOptions().maximumFractionDigits;
|
|
const min = nf.resolvedOptions().minimumFractionDigits;
|
|
|
|
assert.sameValue(min, max, "Currency data not used; maximumFractionDigits should match minimumFractionDigits");
|