basic.js (954B)
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: 12.2.2_a 6 description: > 7 Tests that Intl.DateTimeFormat has a supportedLocalesOf property, 8 and it works as planned. 9 author: Roozbeh Pournader 10 ---*/ 11 12 var defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale; 13 var notSupported = 'zxx'; // "no linguistic content" 14 var requestedLocales = [defaultLocale, notSupported]; 15 16 var supportedLocales; 17 18 assert(Intl.DateTimeFormat.hasOwnProperty('supportedLocalesOf'), "Intl.DateTimeFormat doesn't have a supportedLocalesOf property."); 19 20 supportedLocales = Intl.DateTimeFormat.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.'); 24 25 reportCompare(0, 0);