|
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.Collator.prototype.resolvedOptions |
|
6 * has the right properties. |
|
7 * @author Norbert Lindenberg |
|
8 */ |
|
9 |
|
10 $INCLUDE("testIntl.js"); |
|
11 |
|
12 var actual = new Intl.Collator().resolvedOptions(); |
|
13 |
|
14 var actual2 = new Intl.Collator().resolvedOptions(); |
|
15 if (actual2 === actual) { |
|
16 $ERROR("resolvedOptions returned the same object twice."); |
|
17 } |
|
18 |
|
19 // source: CLDR file common/bcp47/collation.xml; version CLDR 21. |
|
20 var collations = [ |
|
21 "default", // added |
|
22 "big5han", |
|
23 "dict", |
|
24 "direct", |
|
25 "ducet", |
|
26 "gb2312", |
|
27 "phonebk", |
|
28 "phonetic", |
|
29 "pinyin", |
|
30 "reformed", |
|
31 // "search", // excluded |
|
32 "searchjl", |
|
33 // "standard", // excluded |
|
34 "stroke", |
|
35 "trad", |
|
36 "unihan" |
|
37 ]; |
|
38 |
|
39 // this assumes the default values where the specification provides them |
|
40 mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag); |
|
41 mustHaveProperty(actual, "usage", ["sort"]); |
|
42 mustHaveProperty(actual, "sensitivity", ["variant"]); |
|
43 mustHaveProperty(actual, "ignorePunctuation", [false]); |
|
44 mustHaveProperty(actual, "collation", collations); |
|
45 mayHaveProperty(actual, "numeric", [true, false]); |
|
46 mayHaveProperty(actual, "caseFirst", ["upper", "lower", "false"]); |
|
47 |