Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/intl402/NumberFormat/supportedLocalesOf/basic.js

raw
1 // Copyright 2012 Google Inc. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es5id: 11.2.2_a
6 description: >
7 Tests that Intl.NumberFormat has a supportedLocalesOf property,
8 and it works as planned.
9 author: Roozbeh Pournader
10 ---*/
11
12 var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
13 var notSupported = 'zxx'; // "no linguistic content"
14 var requestedLocales = [defaultLocale, notSupported];
15
16 var supportedLocales;
17
18 assert(Intl.NumberFormat.hasOwnProperty('supportedLocalesOf'), "Intl.NumberFormat doesn't have a supportedLocalesOf property.");
19
20 supportedLocales = Intl.NumberFormat.supportedLocalesOf(requestedLocales);
21 assert.sameValue(supportedLocales.length, 1, 'The length of supported locales list is not 1.');
22
23 assert.sameValue(supportedLocales[0], defaultLocale, 'The default locale is not returned in the supported list.');