mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 19:25:43 +00:00
Bug 1543658: Add missing rounding-mode to Intl.PluralRules. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D37705 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
5f1db12cf1
commit
fdac3e6f91
@ -261,6 +261,10 @@ static UNumberFormatter* NewUNumberFormatterForPluralRules(
|
||||
}
|
||||
}
|
||||
|
||||
if (!skeleton.roundingModeHalfUp()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return skeleton.toFormatter(cx, locale.get());
|
||||
}
|
||||
|
||||
|
17
js/src/tests/non262/Intl/PluralRules/rounding.js
Normal file
17
js/src/tests/non262/Intl/PluralRules/rounding.js
Normal file
@ -0,0 +1,17 @@
|
||||
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
|
||||
|
||||
// The rounding mode defaults to half-up for both NumberFormat and PluralRules.
|
||||
|
||||
var locale = "en";
|
||||
var options = {maximumFractionDigits: 0};
|
||||
|
||||
assertEq(new Intl.NumberFormat(locale, options).format(0), "0");
|
||||
assertEq(new Intl.NumberFormat(locale, options).format(0.5), "1");
|
||||
assertEq(new Intl.NumberFormat(locale, options).format(1), "1");
|
||||
|
||||
assertEq(new Intl.PluralRules(locale, options).select(0), "other");
|
||||
assertEq(new Intl.PluralRules(locale, options).select(0.5), "one");
|
||||
assertEq(new Intl.PluralRules(locale, options).select(1), "one");
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(0, 0, 'ok');
|
Loading…
Reference in New Issue
Block a user