From b5d5241dbe76215562e5ac59d4ee5314b5b446fd Mon Sep 17 00:00:00 2001 From: Frank Yung-Fong Tang <41213225+FrankYFTang@users.noreply.github.com> Date: Tue, 2 Apr 2019 09:57:45 -0700 Subject: [PATCH] Update test to allow 'narrow' style for all types Based on the changes in https://github.com/tc39/proposal-intl-list-format/pull/43 We now allow 'narrow' style for all types --- .../constructor/options-style-valid.js | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/test/intl402/ListFormat/constructor/constructor/options-style-valid.js b/test/intl402/ListFormat/constructor/constructor/options-style-valid.js index 01d1cd8ee6..8cfe82adfb 100644 --- a/test/intl402/ListFormat/constructor/constructor/options-style-valid.js +++ b/test/intl402/ListFormat/constructor/constructor/options-style-valid.js @@ -6,9 +6,13 @@ esid: sec-Intl.ListFormat description: Checks handling of valid values for the style option to the ListFormat constructor. info: | InitializeListFormat (listFormat, locales, options) - 9. Let s be ? GetOption(options, "style", "string", «"long", "short", "narrow"», "long"). - 10. Set listFormat.[[Style]] to s. - 14. If style is "narrow" and type is not "unit", throw a RangeError exception. + InitializeListFormat (listFormat, locales, options) + 12. Let type be ? GetOption(options, "type", "string", « "conjunction", + "disjunction", "unit" », "conjunction"). + 13. Set listFormat.[[Type]] to type. + 14. Let style be ? GetOption(options, "style", "string", « "long", "short", + "narrow" », "long"). + 15. Set listFormat.[[Style]] to style. features: [Intl.ListFormat] ---*/ @@ -16,7 +20,10 @@ const validOptions = [ [undefined, "long"], ["long", "long"], ["short", "short"], + ["narrow", "narrow"], [{ toString() { return "short"; } }, "short"], + [{ toString() { return "long"; } }, "long"], + [{ toString() { return "narrow"; } }, "narrow"], ]; for (const [validOption, expected] of validOptions) { @@ -24,11 +31,3 @@ for (const [validOption, expected] of validOptions) { const resolvedOptions = lf.resolvedOptions(); assert.sameValue(resolvedOptions.style, expected); } - -const lf = new Intl.ListFormat([], {"style": "narrow", "type": "unit"}); -const resolvedOptions = lf.resolvedOptions(); -assert.sameValue(resolvedOptions.style, "narrow"); - -assert.throws(RangeError, () => lf = new Intl.ListFormat([], {"style": "narrow"})); -assert.throws(RangeError, () => lf = new Intl.ListFormat([], {"style": "narrow", "type": "conjuction"})); -assert.throws(RangeError, () => lf = new Intl.ListFormat([], {"style": "narrow", "type": "disjuction"}));