michael@0: // Copyright 2012 Google Inc. All rights reserved. michael@0: // This code is governed by the BSD license found in the LICENSE file. michael@0: michael@0: /** michael@0: * @description Tests that Intl.DateTimeFormat has a supportedLocalesOf michael@0: * property, and it works as planned. michael@0: * @author: Roozbeh Pournader michael@0: */ michael@0: michael@0: var defaultLocale = new Intl.DateTimeFormat().resolvedOptions().locale; michael@0: var notSupported = 'zxx'; // "no linguistic content" michael@0: var requestedLocales = [defaultLocale, notSupported]; michael@0: michael@0: var supportedLocales; michael@0: michael@0: if (!Intl.DateTimeFormat.hasOwnProperty('supportedLocalesOf')) { michael@0: $ERROR("Intl.DateTimeFormat doesn't have a supportedLocalesOf property."); michael@0: } michael@0: michael@0: supportedLocales = Intl.DateTimeFormat.supportedLocalesOf(requestedLocales); michael@0: if (supportedLocales.length !== 1) { michael@0: $ERROR('The length of supported locales list is not 1.'); michael@0: } michael@0: michael@0: if (supportedLocales[0] !== defaultLocale) { michael@0: $ERROR('The default locale is not returned in the supported list.'); michael@0: } michael@0: