Debian Codegraph @

js/src/tests/test262/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/basic.js

raw
1 // Copyright 2018 Google Inc., Igalia S.L. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-Intl.RelativeTimeFormat.supportedLocalesOf
6 description: >
7 Tests that Intl.RelativeTimeFormat has a supportedLocalesOf property,
8 and it works as planned.
9 features: [Intl.RelativeTimeFormat]
10 ---*/
11
12 assert.sameValue(typeof Intl.RelativeTimeFormat.supportedLocalesOf, "function",
13 "supportedLocalesOf should be supported.");
14
15 const defaultLocale = new Intl.RelativeTimeFormat().resolvedOptions().locale;
16 const notSupported = 'zxx'; // "no linguistic content"
17 const requestedLocales = [defaultLocale, notSupported];
18
19 const supportedLocales = Intl.RelativeTimeFormat.supportedLocalesOf(requestedLocales);
20 assert.sameValue(supportedLocales.length, 1, 'The length of supported locales list is not 1.');
21 assert.sameValue(supportedLocales[0], defaultLocale, 'The default locale is not returned in the supported list.');
22
23 reportCompare(0, 0);