From cd6198b69cb3d69c548d1468cf2bf6b94c4741fd Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 29 May 2018 17:34:34 +0200 Subject: [PATCH] Add a test for pluralrules.resolvedOptions().pluralCategories. --- .../resolvedOptions/pluralCategories.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/intl402/PluralRules/prototype/resolvedOptions/pluralCategories.js diff --git a/test/intl402/PluralRules/prototype/resolvedOptions/pluralCategories.js b/test/intl402/PluralRules/prototype/resolvedOptions/pluralCategories.js new file mode 100644 index 0000000000..30dc4728dc --- /dev/null +++ b/test/intl402/PluralRules/prototype/resolvedOptions/pluralCategories.js @@ -0,0 +1,29 @@ +// Copyright 2018 Igalia S.L. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +esid: sec-Intl.PluralRules.prototype.resolvedOptions +description: > + Tests that Intl.PluralRules.prototype.resolvedOptions creates a new array + for the pluralCategories property on every call. +includes: [testIntl.js, propertyHelper.js, compareArray.js] +---*/ + +const allowedValues = ["zero", "one", "two", "few", "many", "other"]; + +const pluralrules = new Intl.PluralRules(); +const options1 = pluralrules.resolvedOptions(); +const options2 = pluralrules.resolvedOptions(); + +assert.notSameValue(options1.pluralCategories, options2.pluralCategories, "Should have different arrays"); +assert.compareArray(options1.pluralCategories, options2.pluralCategories, "Arrays should have same values"); + +for (const category of options1.pluralCategories) { + assert(allowedValues.includes(category), `Found ${category}, expected one of ${allowedValues}`); +} + +verifyProperty(options1, "pluralCategories", { + writable: true, + enumerable: true, + configurable: true, +});