Skip to content

Commit 04355af

Browse files
richardlauBethGriggs
authored andcommitted
test: add NumberFormat resolvedOptions test
Add a regression test for NumberFormat resolvedOptions. PR-URL: #39401 Refs: #39050 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 68fd6d5 commit 04355af

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/parallel/test-intl.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ if (!common.hasIntl) {
104104
const numberFormat = new Intl.NumberFormat(['en']).format(12345.67890);
105105
assert.strictEqual(numberFormat, '12,345.679');
106106
}
107+
// Number format resolved options
108+
{
109+
const numberFormat = new Intl.NumberFormat('en-US', { style: 'percent' });
110+
const resolvedOptions = numberFormat.resolvedOptions();
111+
assert.strictEqual(resolvedOptions.locale, 'en-US');
112+
assert.strictEqual(resolvedOptions.style, 'percent');
113+
}
107114
// Significant Digits
108115
{
109116
const loc = ['en-US'];

0 commit comments

Comments
 (0)