michael@0: // Copyright 2012 Mozilla Corporation. All rights reserved. michael@0: // This code is governed by the license found in the LICENSE file. michael@0: michael@0: /** michael@0: * @description Tests that the object returned by Intl.Collator.prototype.resolvedOptions michael@0: * has the right properties. michael@0: * @author Norbert Lindenberg michael@0: */ michael@0: michael@0: $INCLUDE("testIntl.js"); michael@0: michael@0: var actual = new Intl.Collator().resolvedOptions(); michael@0: michael@0: var actual2 = new Intl.Collator().resolvedOptions(); michael@0: if (actual2 === actual) { michael@0: $ERROR("resolvedOptions returned the same object twice."); michael@0: } michael@0: michael@0: // source: CLDR file common/bcp47/collation.xml; version CLDR 21. michael@0: var collations = [ michael@0: "default", // added michael@0: "big5han", michael@0: "dict", michael@0: "direct", michael@0: "ducet", michael@0: "gb2312", michael@0: "phonebk", michael@0: "phonetic", michael@0: "pinyin", michael@0: "reformed", michael@0: // "search", // excluded michael@0: "searchjl", michael@0: // "standard", // excluded michael@0: "stroke", michael@0: "trad", michael@0: "unihan" michael@0: ]; michael@0: michael@0: // this assumes the default values where the specification provides them michael@0: mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag); michael@0: mustHaveProperty(actual, "usage", ["sort"]); michael@0: mustHaveProperty(actual, "sensitivity", ["variant"]); michael@0: mustHaveProperty(actual, "ignorePunctuation", [false]); michael@0: mustHaveProperty(actual, "collation", collations); michael@0: mayHaveProperty(actual, "numeric", [true, false]); michael@0: mayHaveProperty(actual, "caseFirst", ["upper", "lower", "false"]); michael@0: