basic.js (886B)
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: 10.2.2_a 6 description: > 7 Tests that Intl.Collator has a supportedLocalesOf property, and 8 it works as planned. 9 ---*/ 10 11 var defaultLocale = new Intl.Collator().resolvedOptions().locale; 12 var notSupported = 'zxx'; // "no linguistic content" 13 var requestedLocales = [defaultLocale, notSupported]; 14 15 var supportedLocales; 16 17 assert(Intl.Collator.hasOwnProperty('supportedLocalesOf'), "Intl.Collator doesn't have a supportedLocalesOf property."); 18 19 supportedLocales = Intl.Collator.supportedLocalesOf(requestedLocales); 20 assert.sameValue(supportedLocales.length, 1, 'The length of supported locales list is not 1.'); 21 22 assert.sameValue(supportedLocales[0], defaultLocale, 'The default locale is not returned in the supported list.'); 23 24 reportCompare(0, 0);