Fix PluralRules notation test

- Change the locale to "fr", it's more likely to be present in
  implementations when compared to "sl".
- Test all possible "notation" values.
This commit is contained in:
André Bargull 2025-05-26 09:44:10 +02:00 committed by Ms2ger
parent b3d0c57f7f
commit 081cbfc975

View File

@ -12,9 +12,45 @@ info: |
_s_: a decimal String,
): *"zero"*, *"one"*, *"two"*, *"few"*, *"many"*, or *"other"*
...
The returned String characterizes the plural category of _s_ according to _locale_, _type_ and _notation_.
The returned String characterizes the plural category of _s_ according to _locale_, _type_, and _notation_.
...
locale: [fr]
---*/
assert.sameValue(new Intl.PluralRules('sl', { notation: 'compact' }).select(1.00000020e6), 'one', 'compact notation');
assert.sameValue(new Intl.PluralRules('sl', { notation: 'standard' }).select(1.00000020e6), 'other', 'standard notation');
var values = [
{
value: 1e6,
standard: "many",
engineering: "many",
scientific: "many",
compact: "many",
},
{
value: 1.5e6,
standard: "other",
engineering: "many",
scientific: "many",
compact: "many",
},
{
value: 1e-6,
standard: "one",
engineering: "many",
scientific: "many",
compact: "one",
},
];
var prstandard = new Intl.PluralRules("fr", { notation: "standard" });
var prengineering = new Intl.PluralRules("fr", { notation: "engineering" });
var prscientific = new Intl.PluralRules("fr", { notation: "scientific" });
var prcompact = new Intl.PluralRules("fr", { notation: "compact" });
for (var {value, standard, engineering, scientific, compact} of values) {
assert.sameValue(prstandard.select(value), standard, `standard notation: ${value}`);
assert.sameValue(prengineering.select(value), engineering, `engineering notation: ${value}`);
assert.sameValue(prscientific.select(value), scientific, `scientific notation: ${value}`);
assert.sameValue(prcompact.select(value), compact, `compact notation: ${value}`);
}