ab72273692
https://github.com/tc39/proposal-intl-locale Rename locale property to baseName to better reflect the intented use case and the change in spec. TBR: bmeurer@chromium.org Bug: v8:7684 Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng Change-Id: I91b630b49ce73abcebd6040ec968c91d75cff879 Reviewed-on: https://chromium-review.googlesource.com/1014411 Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#53193}
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --harmony-locale
|
|
|
|
// Make sure that locale exposes all required properties. Those not specified
|
|
// should have undefined value.
|
|
|
|
let locale = new Intl.Locale('sr-cyrl-rs-t-ja-u-ca-islamic-x-whatever', {
|
|
calendar: 'buddhist',
|
|
caseFirst: 'true',
|
|
collation: 'phonebk',
|
|
hourCycle: 'h23',
|
|
caseFirst: 'upper',
|
|
numeric: 'true',
|
|
numberingSystem: 'roman'
|
|
});
|
|
assertEquals('sr', locale.language);
|
|
assertEquals('Cyrl', locale.script);
|
|
assertEquals('RS', locale.region);
|
|
assertEquals('sr-Cyrl-RS', locale.baseName);
|
|
assertEquals('buddhist', locale.calendar);
|
|
assertEquals('phonebk', locale.collation);
|
|
assertEquals('h23', locale.hourCycle);
|
|
assertEquals('upper', locale.caseFirst);
|
|
assertEquals(true, locale.numeric);
|
|
assertEquals('roman', locale.numberingSystem);
|
|
// Not defined, expected to undefined.
|
|
assertEquals(undefined, locale.currency);
|
|
assertEquals(undefined, locale.timeZone);
|
|
|
|
// Test property defined in spec, but not specified in locale.
|
|
let missing_property = new Intl.Locale('sr');
|
|
assertEquals(undefined, missing_property.script);
|