Intl.ListFormat: Add a test for unsupported options combinations.

This was changed in https://github.com/tc39/proposal-intl-list-format/pull/27.
This commit is contained in:
Ms2ger 2018-10-10 16:46:15 +02:00 committed by Rick Waldron
parent e5ae99c6ca
commit a3d91b12e5
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// Copyright 2018 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-Intl.ListFormat
description: Checks handling of invalid value for the type option to the ListFormat constructor.
info: |
InitializeListFormat (listFormat, locales, options)
7. Let type be GetOption(options, "type", "string", « "conjunction", "disjunction", "unit" », "conjunction").
features: [Intl.ListFormat]
---*/
const invalidTypes = [
"conjunction",
"disjunction",
];
for (const type of invalidTypes) {
assert.throws(RangeError, function() {
new Intl.ListFormat([], { style: "narrow", type });
}, `${type} is an invalid type option value when style is narrow.`);
}