Debian Codegraph @

js/src/tests/test262/intl402/DurationFormat/supportedLocalesOf/basic.js

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