diff options
-rw-r--r-- | harness/testIntl.js | 16 | ||||
-rw-r--r-- | test/intl402/Collator/prototype/resolvedOptions/10.3.3.js | 16 |
2 files changed, 13 insertions, 19 deletions
diff --git a/harness/testIntl.js b/harness/testIntl.js index 9121f89ae..d0b48fa94 100644 --- a/harness/testIntl.js +++ b/harness/testIntl.js @@ -857,22 +857,6 @@ function testProperty(obj, property, valid) { /** - * Tests whether the named property of the given object, if present at all, has a valid value - * and the default attributes of the properties of an object literal. - * @param {Object} obj the object to be tested. - * @param {string} property the name of the property - * @param {Function|Array} valid either a function that tests value for validity and returns a boolean, - * an array of valid values. - * @exception if the property is present and has an invalid value. - */ -function mayHaveProperty(obj, property, valid) { - if (obj.hasOwnProperty(property)) { - testProperty(obj, property, valid); - } -} - - -/** * Tests whether the given object has the named property with a valid value * and the default attributes of the properties of an object literal. * @param {Object} obj the object to be tested. diff --git a/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js b/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js index 07a975d1c..aeb9ea5f0 100644 --- a/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js +++ b/test/intl402/Collator/prototype/resolvedOptions/10.3.3.js @@ -7,7 +7,7 @@ description: > Tests that the object returned by Intl.Collator.prototype.resolvedOptions has the right properties. author: Norbert Lindenberg -includes: [testIntl.js] +includes: [testIntl.js, propertyHelper.js] ---*/ var actual = new Intl.Collator().resolvedOptions(); @@ -41,5 +41,15 @@ mustHaveProperty(actual, "usage", ["sort"]); mustHaveProperty(actual, "sensitivity", ["variant"]); mustHaveProperty(actual, "ignorePunctuation", [false]); mustHaveProperty(actual, "collation", collations); -mayHaveProperty(actual, "numeric", [true, false]); -mayHaveProperty(actual, "caseFirst", ["upper", "lower", "false"]); + +// "numeric" is an optional property. +if (actual.hasOwnProperty("numeric")) { + assert.notSameValue([true, false].indexOf(actual.numeric), -1); + verifyProperty(actual, "numeric", {writable: true, enumerable: true, configurable: true}); +} + +// "caseFirst" is an optional property. +if (actual.hasOwnProperty("caseFirst")) { + assert.notSameValue(["upper", "lower", "false"].indexOf(actual.caseFirst), -1); + verifyProperty(actual, "caseFirst", {writable: true, enumerable: true, configurable: true}); +} |