|
1 // Copyright 2012 Mozilla Corporation. All rights reserved. |
|
2 // This code is governed by the license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * @description Tests that the object returned by Intl.NumberFormat.prototype.resolvedOptions |
|
6 * has the right properties. |
|
7 * @author Norbert Lindenberg |
|
8 */ |
|
9 |
|
10 $INCLUDE("testIntl.js"); |
|
11 |
|
12 var actual = new Intl.NumberFormat().resolvedOptions(); |
|
13 |
|
14 var actual2 = new Intl.NumberFormat().resolvedOptions(); |
|
15 if (actual2 === actual) { |
|
16 $ERROR("resolvedOptions returned the same object twice."); |
|
17 } |
|
18 |
|
19 // this assumes the default values where the specification provides them |
|
20 mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag); |
|
21 mustHaveProperty(actual, "numberingSystem", isValidNumberingSystem); |
|
22 mustHaveProperty(actual, "style", ["decimal"]); |
|
23 mustNotHaveProperty(actual, "currency"); |
|
24 mustNotHaveProperty(actual, "currencyDisplay"); |
|
25 mustHaveProperty(actual, "minimumIntegerDigits", [1]); |
|
26 mustHaveProperty(actual, "minimumFractionDigits", [0]); |
|
27 mustHaveProperty(actual, "maximumFractionDigits", [3]); |
|
28 mustNotHaveProperty(actual, "minimumSignificantDigits"); |
|
29 mustNotHaveProperty(actual, "maximumSignificantDigits"); |
|
30 mustHaveProperty(actual, "useGrouping", [true]); |
|
31 |