Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | // Copyright 2012 Mozilla Corporation. All rights reserved. |
michael@0 | 2 | // This code is governed by the license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * @description Tests that the object returned by Intl.DateTimeFormat.prototype.resolvedOptions |
michael@0 | 6 | * has the right properties. |
michael@0 | 7 | * @author Norbert Lindenberg |
michael@0 | 8 | */ |
michael@0 | 9 | |
michael@0 | 10 | $INCLUDE("testIntl.js"); |
michael@0 | 11 | |
michael@0 | 12 | var actual = new Intl.DateTimeFormat().resolvedOptions(); |
michael@0 | 13 | |
michael@0 | 14 | var actual2 = new Intl.DateTimeFormat().resolvedOptions(); |
michael@0 | 15 | if (actual2 === actual) { |
michael@0 | 16 | $ERROR("resolvedOptions returned the same object twice."); |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | // source: CLDR file common/bcp47/calendar.xml; version CLDR 21. |
michael@0 | 20 | var calendars = [ |
michael@0 | 21 | "buddhist", |
michael@0 | 22 | "chinese", |
michael@0 | 23 | "coptic", |
michael@0 | 24 | "ethioaa", |
michael@0 | 25 | "ethiopic", |
michael@0 | 26 | "gregory", |
michael@0 | 27 | "hebrew", |
michael@0 | 28 | "indian", |
michael@0 | 29 | "islamic", |
michael@0 | 30 | "islamicc", |
michael@0 | 31 | "iso8601", |
michael@0 | 32 | "japanese", |
michael@0 | 33 | "persian", |
michael@0 | 34 | "roc" |
michael@0 | 35 | ]; |
michael@0 | 36 | |
michael@0 | 37 | // this assumes the default values where the specification provides them |
michael@0 | 38 | mustHaveProperty(actual, "locale", isCanonicalizedStructurallyValidLanguageTag); |
michael@0 | 39 | mustHaveProperty(actual, "calendar", calendars); |
michael@0 | 40 | mustHaveProperty(actual, "numberingSystem", isValidNumberingSystem); |
michael@0 | 41 | mustHaveProperty(actual, "timeZone", [undefined]); |
michael@0 | 42 | mustNotHaveProperty(actual, "weekday"); |
michael@0 | 43 | mustNotHaveProperty(actual, "era"); |
michael@0 | 44 | mustHaveProperty(actual, "year", ["2-digit", "numeric"]); |
michael@0 | 45 | mustHaveProperty(actual, "month", ["2-digit", "numeric", "narrow", "short", "long"]); |
michael@0 | 46 | mustHaveProperty(actual, "day", ["2-digit", "numeric"]); |
michael@0 | 47 | mustNotHaveProperty(actual, "hour"); |
michael@0 | 48 | mustNotHaveProperty(actual, "minute"); |
michael@0 | 49 | mustNotHaveProperty(actual, "second"); |
michael@0 | 50 | mustNotHaveProperty(actual, "timeZoneName"); |
michael@0 | 51 | mustNotHaveProperty(actual, "hour12"); |
michael@0 | 52 |