Simplify default value check of NumberFormat.format

This commit is contained in:
Ujjwal Sharma 2018-09-19 23:24:56 +05:30 committed by Rick Waldron
parent cbfa2c5f00
commit a6412918d2
1 changed files with 3 additions and 29 deletions

View File

@ -12,32 +12,6 @@ info: |
3. If value is not provided, let value be undefined.
---*/
const localesList = [
undefined,
['de'],
['th-u-nu-thai'],
['en'],
['ja-u-nu-jpanfin'],
['ar-u-nu-arab']
];
const optionsList = [
undefined,
{ style: 'percent' },
{ style: 'currency', currency: 'EUR', currencyDisplay: 'symbol' },
{ style: 'currency', currency: 'IQD', currencyDisplay: 'symbol' },
{ style: 'currency', currency: 'KMF', currencyDisplay: 'symbol' },
{ style: 'currency', currency: 'CLF', currencyDisplay: 'symbol' },
{
useGrouping: false,
minimumIntegerDigits: 3,
minimumFractionDigits: 1,
maximumFractionDigits: 3
}
];
localesList.forEach(locales => {
optionsList.forEach(options => {
const nf = Intl.NumberFormat(locales, options);
assert.sameValue(nf.format(), nf.format(undefined));
});
});
const nf = new Intl.NumberFormat();
assert.sameValue(nf.format(), NaN);
assert.sameValue(nf.format(undefined), NaN);