diff options
Diffstat (limited to 'js/src/tests/test262/intl402/RelativeTimeFormat/constructor/constructor/options-numeric-valid.js')
-rw-r--r-- | js/src/tests/test262/intl402/RelativeTimeFormat/constructor/constructor/options-numeric-valid.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/RelativeTimeFormat/constructor/constructor/options-numeric-valid.js b/js/src/tests/test262/intl402/RelativeTimeFormat/constructor/constructor/options-numeric-valid.js new file mode 100644 index 0000000000..d831b94128 --- /dev/null +++ b/js/src/tests/test262/intl402/RelativeTimeFormat/constructor/constructor/options-numeric-valid.js @@ -0,0 +1,27 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.RelativeTimeFormat +description: Checks handling of valid values for the numeric option to the RelativeTimeFormat constructor. +info: | + InitializeRelativeTimeFormat (relativeTimeFormat, locales, options) + 16. Let numeric be ? GetOption(options, "numeric", "string", «"always", "auto"», "always"). + 17. Set relativeTimeFormat.[[Numeric]] to numeric. +features: [Intl.RelativeTimeFormat] +---*/ + +const validOptions = [ + [undefined, "always"], + ["always", "always"], + ["auto", "auto"], + [{ toString() { return "auto"; } }, "auto"], +]; + +for (const [validOption, expected] of validOptions) { + const tf = new Intl.RelativeTimeFormat([], {"numeric": validOption}); + const resolvedOptions = tf.resolvedOptions(); + assert.sameValue(resolvedOptions.numeric, expected); +} + +reportCompare(0, 0); |