提交 dab85c39 编写于 作者: O openharmony_ci 提交者: Gitee

!618 modify testcases on 2021091502

Merge pull request !618 from 杨清/0911
...@@ -12,417 +12,417 @@ ...@@ -12,417 +12,417 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import Intl from "@ohos.intl" import Intl from '@ohos.intl'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('intlTest', function () { describe('intlTest', function () {
console.log("*************start I18NTest*************"); console.log('*************start I18NTest*************');
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0100 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0100
* @tc.name format the language in locale * @tc.name test the language in en-Latn-GB locale
* @tc.desc check the language * @tc.desc check the language
*/ */
it('locale_test_0100', 0, function () { it('locale_test_0100', 0, function () {
let locale = new Intl.Locale("en-Latn-GB"); let locale = new Intl.Locale('en-Latn-GB');
console.log("locale_test_0100 " + locale.language); console.log('locale_test_0100 ' + locale.language);
expect(locale.language).assertEqual("en"); expect(locale.language).assertEqual('en');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0200 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0200
* @tc.name format the language in locale * @tc.name test the language in ja-Jpan-JP-u-ca-japanese-hc-h12-co-emoji locale
* @tc.desc check the language * @tc.desc check the language
*/ */
it('locale_test_0200', 0, function () { it('locale_test_0200', 0, function () {
let locale = new Intl.Locale("ja-Jpan-JP-u-ca-japanese-hc-h12-co-emoji"); let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12-co-emoji');
console.log("locale_test_0200 " + locale.language); console.log('locale_test_0200 ' + locale.language);
expect(locale.language).assertEqual("ja"); expect(locale.language).assertEqual('ja');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0300 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0300
* @tc.name format the script in locale * @tc.name test the script in locale
* @tc.desc check the script * @tc.desc check the script
*/ */
it('locale_test_0300', 0, function () { it('locale_test_0300', 0, function () {
let locale = new Intl.Locale("en-Latn-GB"); let locale = new Intl.Locale('en-Latn-GB');
console.log("locale_test_0300 " + locale.script); console.log('locale_test_0300 ' + locale.script);
expect(locale.script).assertEqual("Latn"); expect(locale.script).assertEqual('Latn');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0400 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0400
* @tc.name format the region in locale * @tc.name test the region in locale
* @tc.desc check the region * @tc.desc check the region
*/ */
it('locale_test_0400', 0, function () { it('locale_test_0400', 0, function () {
let locale = new Intl.Locale("en-Latn-GB"); let locale = new Intl.Locale('en-Latn-GB');
console.log("locale_test_0400 " + locale.region); console.log('locale_test_0400 ' + locale.region);
expect(locale.region).assertEqual("GB"); expect(locale.region).assertEqual('GB');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0500 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0500
* @tc.name format the basename in locale * @tc.name test the basename in locale
* @tc.desc check the basename * @tc.desc check the basename
*/ */
it('locale_test_0500', 0, function () { it('locale_test_0500', 0, function () {
let locale = new Intl.Locale("en-Latn-GB"); let locale = new Intl.Locale('en-Latn-GB');
console.log("locale_test_0500 " + locale.baseName); console.log('locale_test_0500 ' + locale.baseName);
expect(locale.baseName).assertEqual("en-Latn-GB"); expect(locale.baseName).assertEqual('en-Latn-GB');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0600 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0600
* @tc.name format the basename in ja-Jpan-JP-u-ca-japanese-hc-h12 * @tc.name test the basename in ja-Jpan-JP-u-ca-japanese-hc-h12
* @tc.desc check the ja-Jpan-JP-u-ca-japanese-hc-h12 basename * @tc.desc check the ja-Jpan-JP-u-ca-japanese-hc-h12 basename
*/ */
it('locale_test_0600', 0, function () { it('locale_test_0600', 0, function () {
let locale = new Intl.Locale("ja-Jpan-JP-u-ca-japanese-hc-h12"); let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12');
console.log("locale_test_0600 " + locale.baseName); console.log('locale_test_0600 ' + locale.baseName);
expect(locale.baseName).assertEqual("ja-Jpan-JP"); expect(locale.baseName).assertEqual('ja-Jpan-JP');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0700 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0700
* @tc.name format the hourCycle * @tc.name test the hourCycle
* @tc.desc check the hourCycle * @tc.desc check the hourCycle
*/ */
it('locale_test_0700', 0, function () { it('locale_test_0700', 0, function () {
let locale = new Intl.Locale('zh-CN', {hourCycle: 'h24', calendar: 'gregory'}); let locale = new Intl.Locale('zh-CN', {hourCycle: 'h24', calendar: 'gregory'});
console.log("locale_test_0700 " + locale.hourCycle); console.log('locale_test_0700 ' + locale.hourCycle);
expect(locale.hourCycle).assertEqual("h24"); expect(locale.hourCycle).assertEqual('h24');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0800 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0800
* @tc.name format the calendar * @tc.name test the calendar
* @tc.desc check the calendar * @tc.desc check the calendar
*/ */
it('locale_test_0800', 0, function () { it('locale_test_0800', 0, function () {
let locale = new Intl.Locale('zh-CN', {hourCycle: '24', calendar: 'gregory'}); let locale = new Intl.Locale('zh-CN', {hourCycle: '24', calendar: 'gregory'});
console.log("locale_test_0800 " + locale.calendar); console.log('locale_test_0800 ' + locale.calendar);
expect(locale.calendar).assertEqual("gregory"); expect(locale.calendar).assertEqual('gregory');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0900 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_0900
* @tc.name format the japanese calendar * @tc.name test the japanese calendar
* @tc.desc check the japanese calendar * @tc.desc check the japanese calendar
*/ */
it('locale_test_0900', 0, function () { it('locale_test_0900', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12'); let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12');
console.log("locale_test_0900 " + locale.calendar); console.log('locale_test_0900 ' + locale.calendar);
expect(locale.calendar).assertEqual("japanese"); expect(locale.calendar).assertEqual('japanese');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1000 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1000
* @tc.name format the h12 hourCycle * @tc.name test the h12 hourCycle
* @tc.desc check the h12 hourCycle * @tc.desc check the h12 hourCycle
*/ */
it('locale_test_1000', 0, function () { it('locale_test_1000', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12'); let locale = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12');
console.log("locale_test_1000 " + locale.hourCycle); console.log('locale_test_1000 ' + locale.hourCycle);
expect(locale.hourCycle).assertEqual("h12"); expect(locale.hourCycle).assertEqual('h12');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1100 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1100
* @tc.name format the caseFirst * @tc.name test the caseFirst with upper
* @tc.desc check the caseFirst * @tc.desc check the caseFirst
*/ */
it('locale_test_1100', 0, function () { it('locale_test_1100', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'upper'}); let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'upper'});
console.log("locale_test_1100 " + locale.caseFirst); console.log('locale_test_1100 ' + locale.caseFirst);
expect(locale.caseFirst).assertEqual("upper"); expect(locale.caseFirst).assertEqual('upper');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1120 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1120
* @tc.name format the caseFirst * @tc.name test the caseFirst with lower
* @tc.desc check the caseFirst * @tc.desc check the caseFirst
*/ */
it('locale_test_1120', 0, function () { it('locale_test_1120', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'lower'}); let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'lower'});
console.log("locale_test_1120 " + locale.caseFirst); console.log('locale_test_1120 ' + locale.caseFirst);
expect(locale.caseFirst).assertEqual("lower"); expect(locale.caseFirst).assertEqual('lower');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1140 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1140
* @tc.name format the caseFirst * @tc.name test the caseFirst with false
* @tc.desc check the caseFirst * @tc.desc check the caseFirst
*/ */
it('locale_test_1140', 0, function () { it('locale_test_1140', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'false'}); let locale = new Intl.Locale('ja-Jpan-JP', {caseFirst: 'false'});
console.log("locale_test_1140 " + locale.caseFirst); console.log('locale_test_1140 ' + locale.caseFirst);
expect(locale.caseFirst).assertEqual("false"); expect(locale.caseFirst).assertEqual('false');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1200 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1200
* @tc.name format the collation * @tc.name test the collation
* @tc.desc check the collation * @tc.desc check the collation
*/ */
it('locale_test_1200', 0, function () { it('locale_test_1200', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {collation: 'big5han'}); let locale = new Intl.Locale('ja-Jpan-JP', {collation: 'big5han'});
console.log("locale_test_1200 " + locale.collation); console.log('locale_test_1200 ' + locale.collation);
expect(locale.collation).assertEqual("big5han"); expect(locale.collation).assertEqual('big5han');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1300 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1300
* @tc.name format the numeric * @tc.name test the numeric
* @tc.desc check the numeric * @tc.desc check the numeric
*/ */
it('locale_test_1300', 0, function () { it('locale_test_1300', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {numeric: true}); let locale = new Intl.Locale('ja-Jpan-JP', {numeric: true});
console.log("locale_test_1300 " + locale.numeric); console.log('locale_test_1300 ' + locale.numeric);
expect(locale.numeric === true).assertTrue(); expect(locale.numeric === true).assertTrue();
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1400 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1400
* @tc.name format the numeric * @tc.name test the numberingSystem
* @tc.desc check the numeric * @tc.desc check the numberingSystem
*/ */
it('locale_test_1400', 0, function () { it('locale_test_1400', 0, function () {
let locale = new Intl.Locale('ja-Jpan-JP', {numberingSystem: 'arab'}); let locale = new Intl.Locale('ja-Jpan-JP', {numberingSystem: 'arab'});
console.log("locale_test_1400 " + locale.numberingSystem); console.log('locale_test_1400 ' + locale.numberingSystem);
expect(locale.numberingSystem).assertEqual("arab"); expect(locale.numberingSystem).assertEqual('arab');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1500 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1500
* @tc.name test the toString interface * @tc.name test the toString interface with zh
* @tc.desc check the toString method * @tc.desc check the toString method with zh
*/ */
it('locale_test_1500', 0, function () { it('locale_test_1500', 0, function () {
let locale = new Intl.Locale('zh'); let locale = new Intl.Locale('zh');
console.log("locale_test_1500 " + locale.toString()); console.log('locale_test_1500 ' + locale.toString());
expect(locale.toString()).assertEqual("zh"); expect(locale.toString()).assertEqual('zh');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1600 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1600
* @tc.name test the toString interface * @tc.name test the toString interface with zh-CN
* @tc.desc check the toString method * @tc.desc check the toString method with zh-CN
*/ */
it('locale_test_1600', 0, function () { it('locale_test_1600', 0, function () {
let locale = new Intl.Locale('zh-CN'); let locale = new Intl.Locale('zh-CN');
console.log("locale_test_1600 " + locale.toString()); console.log('locale_test_1600 ' + locale.toString());
expect(locale.toString()).assertEqual("zh-CN"); expect(locale.toString()).assertEqual('zh-CN');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1700 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1700
* @tc.name test the toString interface * @tc.name test the toString interface with zh-Hans-CN
* @tc.desc check the toString method * @tc.desc check the toString method with zh-Hans-CN
*/ */
it('locale_test_1700', 0, function () { it('locale_test_1700', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN'); let locale = new Intl.Locale('zh-Hans-CN');
console.log("locale_test_1700 " + locale.toString()); console.log('locale_test_1700 ' + locale.toString());
expect(locale.toString()).assertEqual("zh-Hans-CN"); expect(locale.toString()).assertEqual('zh-Hans-CN');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1800 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1800
* @tc.name test the toString interface * @tc.name test the toString interface with zh-Hans-CN-u-hc-h12-ca-japanese
* @tc.desc check the toString method * @tc.desc check the toString method with zh-Hans-CN-u-hc-h12-ca-japanese
*/ */
it('locale_test_1800', 0, function () { it('locale_test_1800', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN-u-ca-japanese-hc-h12'); let locale = new Intl.Locale('zh-Hans-CN-u-ca-japanese-hc-h12');
console.log("locale_test_1800 " + locale.toString()); console.log('locale_test_1800 ' + locale.toString());
expect(locale.toString()).assertEqual("zh-Hans-CN-u-hc-h12-ca-japanese"); expect(locale.toString()).assertEqual('zh-Hans-CN-u-hc-h12-ca-japanese');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1900 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_1900
* @tc.name test the maximize interface * @tc.name test the maximize interface with zh-u-ca-gregory-co-compact param
* @tc.desc check the maximize method * @tc.desc check the maximize method with zh-u-ca-gregory-co-compact param
*/ */
it('locale_test_1900', 0, function () { it('locale_test_1900', 0, function () {
let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_1900 " + locale.toString()); console.log('locale_test_1900 ' + locale.toString());
expect(locale.toString()).assertEqual("zh-u-ca-gregory-co-compact"); expect(locale.toString()).assertEqual('zh-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2000 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2000
* @tc.name test the toString interface * @tc.name test the toString interface with zh-CN-u-ca-gregory-co-compact param
* @tc.desc check the toString method * @tc.desc check the toString method with zh-CN-u-ca-gregory-co-compact param
*/ */
it('locale_test_2000', 0, function () { it('locale_test_2000', 0, function () {
let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2000 " + locale.toString()); console.log('locale_test_2000 ' + locale.toString());
expect(locale.toString()).assertEqual("zh-CN-u-ca-gregory-co-compact"); expect(locale.toString()).assertEqual('zh-CN-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2100 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2100
* @tc.name test the mininize interface * @tc.name test the toString interface with zh-hans-CN-u-ca-gregory-co-compact param
* @tc.desc check the mininize method * @tc.desc check the toString method with zh-hans-CN-u-ca-gregory-co-compact param
*/ */
it('locale_test_2100', 0, function () { it('locale_test_2100', 0, function () {
let locale = new Intl.Locale('zh-hans-CN', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh-hans-CN', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2100 " + locale.toString()); console.log('locale_test_2100 ' + locale.toString());
expect(locale.toString()).assertEqual("zh-hans-CN-u-ca-gregory-co-compact"); expect(locale.toString()).assertEqual('zh-hans-CN-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2200 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2200
* @tc.name test the mininize interface * @tc.name test the mininize interface with one param zh
* @tc.desc check the mininize method * @tc.desc check the mininize method with one param zh
*/ */
it('locale_test_2200', 0, function () { it('locale_test_2200', 0, function () {
let locale = new Intl.Locale('zh'); let locale = new Intl.Locale('zh');
console.log("locale_test_2200 " + locale.mininize().toString()); console.log('locale_test_2200 ' + locale.mininize().toString());
expect(locale.minimize().toString()).assertEqual("zh"); expect(locale.minimize().toString()).assertEqual('zh');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2201 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2201
* @tc.name test the mininize interface * @tc.name test the mininize interface with one param zh-CN
* @tc.desc check the mininize method * @tc.desc check the mininize method with one param zh-CN
*/ */
it('locale_test_2201', 0, function () { it('locale_test_2201', 0, function () {
let locale = new Intl.Locale('zh-CN'); let locale = new Intl.Locale('zh-CN');
console.log("locale_test_2201 " + locale.mininize().toString()); console.log('locale_test_2201 ' + locale.mininize().toString());
expect(locale.minimize().toString()).assertEqual("zh"); expect(locale.minimize().toString()).assertEqual('zh');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2202 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2202
* @tc.name test the mininize interface * @tc.name test the mininize interface with one param zh-Hans-CN
* @tc.desc check the mininize method * @tc.desc check the mininize method with one param zh-Hans-CN
*/ */
it('locale_test_2202', 0, function () { it('locale_test_2202', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN'); let locale = new Intl.Locale('zh-Hans-CN');
console.log("locale_test_2202 " + locale.mininize().toString()); console.log('locale_test_2202 ' + locale.mininize().toString());
expect(locale.minimize().toString()).assertEqual("zh"); expect(locale.minimize().toString()).assertEqual('zh');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2203 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2203
* @tc.name test the mininize interface * @tc.name test the mininize interface with one param zh-Hans-CN-u-ca-gregory-co-compact
* @tc.desc check the mininize method * @tc.desc check the mininize method with one param zh-Hans-CN-u-ca-gregory-co-compact
*/ */
it('locale_test_2203', 0, function () { it('locale_test_2203', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN-u-ca-gregory-co-compact'); let locale = new Intl.Locale('zh-Hans-CN-u-ca-gregory-co-compact');
console.log("locale_test_2203 " + locale.mininize().toString()); console.log('locale_test_2203 ' + locale.mininize().toString());
expect(locale.minimize().toString()).assertEqual("zh"); expect(locale.minimize().toString()).assertEqual('zh');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2204 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2204
* @tc.name test the mininize interface * @tc.name test the mininize interface with zh lcoale
* @tc.desc check the mininize method * @tc.desc check the mininize method with zh lcoale
*/ */
it('locale_test_2204', 0, function () { it('locale_test_2204', 0, function () {
let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2204 " + locale.mininize().toString()); console.log('locale_test_2204 ' + locale.mininize().toString());
expect(locale.minimize().toString()).assertEqual("zh-u-ca-gregory-co-compact"); expect(locale.minimize().toString()).assertEqual('zh-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2205 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2205
* @tc.name test the mininize interface * @tc.name test the mininize interface with zh-CN lcoale
* @tc.desc check the mininize method * @tc.desc check the mininize method with zh-CN lcoale
*/ */
it('locale_test_2205', 0, function () { it('locale_test_2205', 0, function () {
let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2205 " + locale.mininize().toString()); console.log('locale_test_2205 ' + locale.mininize().toString());
expect(locale.minimize().toString()).assertEqual("zh-u-ca-gregory-co-compact"); expect(locale.minimize().toString()).assertEqual('zh-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2206 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2206
* @tc.name test the mininize interface * @tc.name test the mininize interface with zh-Hans-CN lcoale
* @tc.desc check the mininize method * @tc.desc check the mininize method with zh-Hans-CN lcoale
*/ */
it('locale_test_2206', 0, function () { it('locale_test_2206', 0, function () {
let locale = new Intl.Locale('zh-hans-CN', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh-hans-CN', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2206 " + locale.mininize().toString()); console.log('locale_test_2206 ' + locale.mininize().toString());
expect(locale.minimize().toString()).assertEqual("zh-u-ca-gregory-co-compact"); expect(locale.minimize().toString()).assertEqual('zh-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2300 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2300
* @tc.name test the maximize interface * @tc.name test the maximize interface with one param zh
* @tc.desc check the maximize method * @tc.desc check the maximize method with one param zh
*/ */
it('locale_test_2300', 0, function () { it('locale_test_2300', 0, function () {
let locale = new Intl.Locale('zh'); let locale = new Intl.Locale('zh');
console.log("locale_test_2300 " + locale.maximize().toString()); console.log('locale_test_2300 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual("zh-Hans-CN"); expect(locale.maximize().toString()).assertEqual('zh-Hans-CN');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2301 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2301
* @tc.name test the maximize interface * @tc.name test the maximize interface with one param zh-CN
* @tc.desc check the maximize method * @tc.desc check the maximize method with one param zh-CN
*/ */
it('locale_test_2301', 0, function () { it('locale_test_2301', 0, function () {
let locale = new Intl.Locale('zh-CN'); let locale = new Intl.Locale('zh-CN');
console.log("locale_test_2301 " + locale.maximize().toString()); console.log('locale_test_2301 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual("zh-Hans-CN"); expect(locale.maximize().toString()).assertEqual('zh-Hans-CN');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2302 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2302
* @tc.name test the maximize interface * @tc.name test the maximize interface with one param zh-Hans-CN-u-ca-gregory-co-compact
* @tc.desc check the maximize method * @tc.desc check the maximize method with one param zh-Hans-CN-u-ca-gregory-co-compact
*/ */
it('locale_test_2302', 0, function () { it('locale_test_2302', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN'); let locale = new Intl.Locale('zh-Hans-CN');
console.log("locale_test_2302 " + locale.maximize().toString()); console.log('locale_test_2302 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual("zh-Hans-CN"); expect(locale.maximize().toString()).assertEqual('zh-Hans-CN');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2303 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2303
* @tc.name test the mininize interface * @tc.name test the mininize interface with zh-Hans-CN-u-ca-gregory-co-compact locale
* @tc.desc check the mininize method * @tc.desc check the mininize method with zh-Hans-CN-u-ca-gregory-co-compact locale
*/ */
it('locale_test_2303', 0, function () { it('locale_test_2303', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN-u-ca-gregory-co-compact'); let locale = new Intl.Locale('zh-Hans-CN-u-ca-gregory-co-compact');
console.log("locale_test_2303 " + locale.maximize().toString()); console.log('locale_test_2303 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual("zh-Hans-CN-u-ca-gregory-co-compact"); expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2304 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2304
* @tc.name test the maximize interface * @tc.name test the maximize interface with zh locale
* @tc.desc check the maximize method * @tc.desc check the maximize method with zh locale
*/ */
it('locale_test_2304', 0, function () { it('locale_test_2304', 0, function () {
let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2304 " + locale.maximize().toString()); console.log('locale_test_2304 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual("zh-Hans-CN-u-ca-gregory-co-compact"); expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2305 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2305
* @tc.name test the maximize interface * @tc.name test the maximize interface with zh-CN locale
* @tc.desc check the maximize method * @tc.desc check the maximize method with zh-CN locale
*/ */
it('locale_test_2305', 0, function () { it('locale_test_2305', 0, function () {
let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh-CN', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2305 " + locale.maximize().toString()); console.log('locale_test_2305 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual("zh-Hans-CN-u-ca-gregory-co-compact"); expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2306 * @tc.number SUB_GLOBAL_I18N_JS_LOCALE_2306
* @tc.name test the maximize interface * @tc.name test the maximize interface with zh-Hans-CN locale
* @tc.desc check the maximize method * @tc.desc check the maximize method with zh-Hans-CN locale
*/ */
it('locale_test_2306', 0, function () { it('locale_test_2306', 0, function () {
let locale = new Intl.Locale('zh-Hans-CN', {calendar: 'gregory', collation: 'compact'}); let locale = new Intl.Locale('zh-Hans-CN', {calendar: 'gregory', collation: 'compact'});
console.log("locale_test_2306 " + locale.maximize().toString()); console.log('locale_test_2306 ' + locale.maximize().toString());
expect(locale.maximize().toString()).assertEqual("zh-Hans-CN-u-ca-gregory-co-compact"); expect(locale.maximize().toString()).assertEqual('zh-Hans-CN-u-ca-gregory-co-compact');
}) })
/* * /* *
...@@ -431,43 +431,43 @@ describe('intlTest', function () { ...@@ -431,43 +431,43 @@ describe('intlTest', function () {
* @tc.desc check the datetime is not null * @tc.desc check the datetime is not null
*/ */
it('dateTimeFormat_test_0100', 0, function () { it('dateTimeFormat_test_0100', 0, function () {
let datefmt = new Intl.DateTimeFormat("en-GB"); let datefmt = new Intl.DateTimeFormat('en-GB');
expect(datefmt !== null).assertTrue(); expect(datefmt !== null).assertTrue();
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0200 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0200
* @tc.name format the date with en-GB locale * @tc.name format the date with zh locale
* @tc.desc check the date * @tc.desc check the date
*/ */
it('dateTimeFormat_test_0200', 0, function () { it('dateTimeFormat_test_0200', 0, function () {
let date = new Date(2021, 11, 17, 3, 24, 0); let date = new Date(2021, 11, 17, 3, 24, 0);
let datefmt = new Intl.DateTimeFormat("zh"); let datefmt = new Intl.DateTimeFormat('zh');
console.log("dateTimeFormat_test_0200 " + datefmt.format(date)); console.log('dateTimeFormat_test_0200 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('2021/12/17'); expect(datefmt.format(date)).assertEqual('2021/12/17');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0300 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0300
* @tc.name format the date with en-GB locale * @tc.name format the date with en locale
* @tc.desc check the date * @tc.desc check the date
*/ */
it('dateTimeFormat_test_0300', 0, function () { it('dateTimeFormat_test_0300', 0, function () {
let date = new Date(2021, 11, 17, 3, 24, 0); let date = new Date(2021, 11, 17, 3, 24, 0);
let datefmt = new Intl.DateTimeFormat("en"); let datefmt = new Intl.DateTimeFormat('en');
console.log("dateTimeFormat_test_0300 " + datefmt.format(date)); console.log('dateTimeFormat_test_0300 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('12/17/21'); expect(datefmt.format(date)).assertEqual('12/17/21');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0310 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0310
* @tc.name format the date with en-GB locale * @tc.name format the date with en-US locale
* @tc.desc check the date * @tc.desc check the date
*/ */
it('dateTimeFormat_test_0310', 0, function () { it('dateTimeFormat_test_0310', 0, function () {
let date = new Date(2021, 11, 17, 3, 24, 0); let date = new Date(2021, 11, 17, 3, 24, 0);
let datefmt = new Intl.DateTimeFormat("en-US"); let datefmt = new Intl.DateTimeFormat('en-US');
console.log("dateTimeFormat_test_0310 " + datefmt.format(date)); console.log('dateTimeFormat_test_0310 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('12/17/21'); expect(datefmt.format(date)).assertEqual('12/17/21');
}) })
...@@ -478,72 +478,72 @@ describe('intlTest', function () { ...@@ -478,72 +478,72 @@ describe('intlTest', function () {
*/ */
it('dateTimeFormat_test_0320', 0, function () { it('dateTimeFormat_test_0320', 0, function () {
let date = new Date(2021, 11, 17, 3, 24, 0); let date = new Date(2021, 11, 17, 3, 24, 0);
let datefmt = new Intl.DateTimeFormat("en-GB"); let datefmt = new Intl.DateTimeFormat('en-GB');
console.log("dateTimeFormat_test_0320 " + datefmt.format(date)); console.log('dateTimeFormat_test_0320 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('17/12/2021'); expect(datefmt.format(date)).assertEqual('17/12/2021');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0400 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0400
* @tc.name format the date with en-GB locale * @tc.name format the date with aa locale
* @tc.desc check the date * @tc.desc check the date
*/ */
// it('dateTimeFormat_test_0400', 0, function () { // it('dateTimeFormat_test_0400', 0, function () {
// let date = new Date(2021, 11, 17, 3, 24, 0); // let date = new Date(2021, 11, 17, 3, 24, 0);
// let datefmt = new Intl.DateTimeFormat("aa"); // let datefmt = new Intl.DateTimeFormat('aa');
// console.log("dateTimeFormat_test_0400 " + datefmt.format(date)); // console.log('dateTimeFormat_test_0400 ' + datefmt.format(date));
// expect(datefmt.format(date)).assertEqual('2021/12/17'); // expect(datefmt.format(date)).assertEqual('2021/12/17');
// }) // })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0500 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0500
* @tc.name format the hour * @tc.name format the hour with ban and zh locale
* @tc.desc check the hour * @tc.desc check the hour with ban and zh locale
*/ */
it('dateTimeFormat_test_0500', 0, function () { it('dateTimeFormat_test_0500', 0, function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { dateStyle: 'full' }; let option = { dateStyle: 'full' };
let datefmt = new Intl.DateTimeFormat(['ban', 'zh'], option); let datefmt = new Intl.DateTimeFormat(['ban', 'zh'], option);
console.log("dateTimeFormat_test_0500 " + datefmt.format(date)); console.log('dateTimeFormat_test_0500 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('2020年12月20日星期日'); expect(datefmt.format(date)).assertEqual('2020年12月20日星期日');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0600 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0600
* @tc.name format the hour * @tc.name format the hour with en and zh locale
* @tc.desc check the hour * @tc.desc check the hour with en and zh locale
*/ */
it('dateTimeFormat_test_0600', 0, function () { it('dateTimeFormat_test_0600', 0, function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { dateStyle: 'full' }; let option = { dateStyle: 'full' };
let datefmt = new Intl.DateTimeFormat(['en', 'zh'], option); let datefmt = new Intl.DateTimeFormat(['en', 'zh'], option);
console.log("dateTimeFormat_test_0600 " + datefmt.format(date)); console.log('dateTimeFormat_test_0600 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020'); expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0700 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0700
* @tc.name format the hour * @tc.name format the hour with en and ban locale
* @tc.desc check the hour * @tc.desc check the hour with en and ban locale
*/ */
it('dateTimeFormat_test_0700', 0, function () { it('dateTimeFormat_test_0700', 0, function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { dateStyle: 'full' }; let option = { dateStyle: 'full' };
let datefmt = new Intl.DateTimeFormat(['en', 'ban'], option); let datefmt = new Intl.DateTimeFormat(['en', 'ban'], option);
console.log("dateTimeFormat_test_0700 " + datefmt.format(date)); console.log('dateTimeFormat_test_0700 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020'); expect(datefmt.format(date)).assertEqual('Sunday, December 20, 2020');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0800 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_0800
* @tc.name format the hour * @tc.name format the hour without correct locale
* @tc.desc check the hour * @tc.desc check the hour without correct locale
*/ */
// it('dateTimeFormat_test_0800', 0, function () { // it('dateTimeFormat_test_0800', 0, function () {
// let date = new Date(2020, 11, 20, 14, 23, 16); // let date = new Date(2020, 11, 20, 14, 23, 16);
// let option = { dateStyle: 'full' }; // let option = { dateStyle: 'full' };
// let datefmt = new Intl.DateTimeFormat(['abc', 'ban'], option); // let datefmt = new Intl.DateTimeFormat(['abc', 'ban'], option);
// console.log("dateTimeFormat_test_0800 " + datefmt.format(date)); // console.log('dateTimeFormat_test_0800 ' + datefmt.format(date));
// expect(datefmt.format(date)).assertEqual('12/20/20, 2:23 PM'); // expect(datefmt.format(date)).assertEqual('12/20/20, 2:23 PM');
// }) // })
...@@ -556,48 +556,48 @@ describe('intlTest', function () { ...@@ -556,48 +556,48 @@ describe('intlTest', function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { dateStyle: 'full', timeStyle: 'full' }; let option = { dateStyle: 'full', timeStyle: 'full' };
let datefmt = new Intl.DateTimeFormat('zh-Hans-CN', option); let datefmt = new Intl.DateTimeFormat('zh-Hans-CN', option);
console.log("dateTimeFormat_test_0900 " + datefmt.format(date)); console.log('dateTimeFormat_test_0900 ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('2020年12月20日星期日 协调世界时 下午2:23:16'); expect(datefmt.format(date)).assertEqual('2020年12月20日星期日 协调世界时 下午2:23:16');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1000 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1000
* @tc.name format the date dateStyle * @tc.name format the date dateStyle with long style
* @tc.desc check the dateStyle * @tc.desc check the dateStyle with long style
*/ */
it('dateTimeFormat_test_1000', 0, function () { it('dateTimeFormat_test_1000', 0, function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { dateStyle: 'long', timeStyle: 'long' }; let option = { dateStyle: 'long', timeStyle: 'long' };
let datefmt = new Intl.DateTimeFormat('zh-CN', option); let datefmt = new Intl.DateTimeFormat('zh-CN', option);
console.log("dateTimeFormat_test_1000 " + datefmt.resolvedOptions().dateStyle); console.log('dateTimeFormat_test_1000 ' + datefmt.resolvedOptions().dateStyle);
expect(datefmt.resolvedOptions().dateStyle).assertEqual('long'); expect(datefmt.resolvedOptions().dateStyle).assertEqual('long');
expect(datefmt.format(date)).assertEqual('2020年12月20日 UTC 下午2:23:16'); expect(datefmt.format(date)).assertEqual('2020年12月20日 UTC 下午2:23:16');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1100 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1100
* @tc.name format the date dateStyle * @tc.name format the date dateStyle with medium style
* @tc.desc check the dateStyle * @tc.desc check the dateStyle with medium style
*/ */
it('dateTimeFormat_test_1100', 0, function () { it('dateTimeFormat_test_1100', 0, function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { dateStyle: 'medium', timeStyle: 'medium' }; let option = { dateStyle: 'medium', timeStyle: 'medium' };
let datefmt = new Intl.DateTimeFormat('zh-CN', option); let datefmt = new Intl.DateTimeFormat('zh-CN', option);
console.log("dateTimeFormat_test_1100 " + datefmt.resolvedOptions().dateStyle); console.log('dateTimeFormat_test_1100 ' + datefmt.resolvedOptions().dateStyle);
expect(datefmt.resolvedOptions().dateStyle).assertEqual('medium'); expect(datefmt.resolvedOptions().dateStyle).assertEqual('medium');
expect(datefmt.format(date)).assertEqual('2020年12月20日 下午2:23:16'); expect(datefmt.format(date)).assertEqual('2020年12月20日 下午2:23:16');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1200 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1200
* @tc.name format the date dateStyle * @tc.name format the date dateStyle with short style
* @tc.desc check the dateStyle * @tc.desc check the dateStyle with short style
*/ */
it('dateTimeFormat_test_1200', 0, function () { it('dateTimeFormat_test_1200', 0, function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { dateStyle: 'short', timeStyle: 'short' }; let option = { dateStyle: 'short', timeStyle: 'short' };
let datefmt = new Intl.DateTimeFormat('zh-CN', option); let datefmt = new Intl.DateTimeFormat('zh-CN', option);
console.log("dateTimeFormat_test_1200 " + datefmt.resolvedOptions().dateStyle); console.log('dateTimeFormat_test_1200 ' + datefmt.resolvedOptions().dateStyle);
expect(datefmt.resolvedOptions().dateStyle).assertEqual('short'); expect(datefmt.resolvedOptions().dateStyle).assertEqual('short');
expect(datefmt.format(date)).assertEqual('2020/12/20 下午2:23'); expect(datefmt.format(date)).assertEqual('2020/12/20 下午2:23');
}) })
...@@ -611,20 +611,20 @@ describe('intlTest', function () { ...@@ -611,20 +611,20 @@ describe('intlTest', function () {
let startdate = new Date(2020, 11, 20, 14, 23, 16); let startdate = new Date(2020, 11, 20, 14, 23, 16);
let enddate = new Date(2020, 11, 21, 14, 23, 16); let enddate = new Date(2020, 11, 21, 14, 23, 16);
let datefmt = new Intl.DateTimeFormat('en-GB'); let datefmt = new Intl.DateTimeFormat('en-GB');
console.log("dateTimeFormat_test_1300 " + datefmt.formatRange(startdate, enddate)); console.log('dateTimeFormat_test_1300 ' + datefmt.formatRange(startdate, enddate));
expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020 – 21/12/2020'); expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020 – 21/12/2020');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1400 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_1400
* @tc.name format the date with daterange * @tc.name format the date with daterange when the start and end date is equal
* @tc.desc check the daterange * @tc.desc check the daterange when the start and end date is equal
*/ */
it('dateTimeFormat_test_1400', 0, function () { it('dateTimeFormat_test_1400', 0, function () {
let startdate = new Date(2020, 11, 20, 14, 23, 16); let startdate = new Date(2020, 11, 20, 14, 23, 16);
let enddate = new Date(2020, 11, 20, 14, 23, 16); let enddate = new Date(2020, 11, 20, 14, 23, 16);
let datefmt = new Intl.DateTimeFormat('en-GB'); let datefmt = new Intl.DateTimeFormat('en-GB');
console.log("dateTimeFormat_test_1400 " + datefmt.formatRange(startdate, enddate)); console.log('dateTimeFormat_test_1400 ' + datefmt.formatRange(startdate, enddate));
expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020'); expect(datefmt.formatRange(startdate, enddate)).assertEqual('20/12/2020');
}) })
...@@ -637,7 +637,7 @@ describe('intlTest', function () { ...@@ -637,7 +637,7 @@ describe('intlTest', function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' }; let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
let datefmt = new Intl.DateTimeFormat('ja', option); let datefmt = new Intl.DateTimeFormat('ja', option);
console.log("jessie " + datefmt.format(date)); console.log('jessie ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('2020年12月20日日曜日'); expect(datefmt.format(date)).assertEqual('2020年12月20日日曜日');
}) })
...@@ -651,7 +651,7 @@ describe('intlTest', function () { ...@@ -651,7 +651,7 @@ describe('intlTest', function () {
let enddate = new Date(2021, 4, 5, 10, 5, 3); let enddate = new Date(2021, 4, 5, 10, 5, 3);
let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' }; let option = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' };
let datefmt = new Intl.DateTimeFormat('en', option); let datefmt = new Intl.DateTimeFormat('en', option);
console.log("jessie 007 " + datefmt.formatRange(startdate, enddate)); console.log('jessie 007 ' + datefmt.formatRange(startdate, enddate));
expect(datefmt.formatRange(startdate, enddate)).assertEqual('Sunday, December 20, 2020 – Wednesday, May 5, 2021'); expect(datefmt.formatRange(startdate, enddate)).assertEqual('Sunday, December 20, 2020 – Wednesday, May 5, 2021');
}) })
...@@ -665,7 +665,7 @@ describe('intlTest', function () { ...@@ -665,7 +665,7 @@ describe('intlTest', function () {
let option = { year: 'numeric', month: 'long', day: 'numeric', let option = { year: 'numeric', month: 'long', day: 'numeric',
hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' }; hour: 'numeric', minute: '2-digit', second: 'numeric', weekday: 'long', era: 'short' };
let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option); let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
console.log("jessie " + datefmt.format(date)); console.log('jessie ' + datefmt.format(date));
expect(datefmt.format(date)).assertEqual('公元2020年12月20日星期日 下午2:23:16'); expect(datefmt.format(date)).assertEqual('公元2020年12月20日星期日 下午2:23:16');
}) })
...@@ -678,7 +678,7 @@ describe('intlTest', function () { ...@@ -678,7 +678,7 @@ describe('intlTest', function () {
let date = new Date(2020, 3, 14, 15, 5, 3); let date = new Date(2020, 3, 14, 15, 5, 3);
let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' }; let option = { timeZone: 'America/Los_Angeles', timeZoneName: 'long' };
let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option); let datefmt = new Intl.DateTimeFormat('zh-CN-u-hc-h12', option);
console.log("jessie " + datefmt.format(date)); console.log('jessie ' + datefmt.format(date));
expect(datefmt.format(date).indexOf('北美太平洋夏令时间') !== -1).assertEqual(true); expect(datefmt.format(date).indexOf('北美太平洋夏令时间') !== -1).assertEqual(true);
}) })
...@@ -730,8 +730,8 @@ describe('intlTest', function () { ...@@ -730,8 +730,8 @@ describe('intlTest', function () {
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_2300 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_2300
* @tc.name format the hour * @tc.name format the hour in zh-CN-u-hc-h12
* @tc.desc check the hour * @tc.desc check the hour in zh-CN-u-hc-h12
*/ */
it('dateTimeFormat_test_2300', 0, function () { it('dateTimeFormat_test_2300', 0, function () {
let option = { year: 'numeric', month: 'long', day: 'numeric', let option = { year: 'numeric', month: 'long', day: 'numeric',
...@@ -742,8 +742,8 @@ describe('intlTest', function () { ...@@ -742,8 +742,8 @@ describe('intlTest', function () {
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_2400 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_2400
* @tc.name format the hour * @tc.name format the hour in fr-Latn-FR-u-nu-mong
* @tc.desc check the hour * @tc.desc check the hour in fr-Latn-FR-u-nu-mong
*/ */
it('dateTimeFormat_test_2400', 0, function () { it('dateTimeFormat_test_2400', 0, function () {
let date = new Date(2020, 11, 20, 14, 23, 16); let date = new Date(2020, 11, 20, 14, 23, 16);
...@@ -754,8 +754,8 @@ describe('intlTest', function () { ...@@ -754,8 +754,8 @@ describe('intlTest', function () {
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_DATETIME_2500 * @tc.number SUB_GLOBAL_I18N_JS_DATETIME_2500
* @tc.name format the hour * @tc.name format the hour in zh-CN-u-hc-h12 with matcher
* @tc.desc check the hour * @tc.desc check the hour in zh-CN-u-hc-h12 with matcher
*/ */
it('dateTimeFormat_test_2500', 0, function () { it('dateTimeFormat_test_2500', 0, function () {
let option = { year: 'numeric', month: 'long', day: 'numeric', let option = { year: 'numeric', month: 'long', day: 'numeric',
...@@ -779,56 +779,56 @@ describe('intlTest', function () { ...@@ -779,56 +779,56 @@ describe('intlTest', function () {
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0100 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0100
* @tc.name format the number in en-GB * @tc.name format the number in zh
* @tc.desc check the number in en-GB * @tc.desc check the number in zh
*/ */
it('formatNumber_test_0100', 0, function () { it('formatNumber_test_0100', 0, function () {
let numfmt = new Intl.NumberFormat('zh'); let numfmt = new Intl.NumberFormat('zh');
console.log("formatNumber_test_0100 " + numfmt.format(123456.789)); console.log('formatNumber_test_0100 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0200 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0200
* @tc.name format the number in en-GB * @tc.name format the number in zh-u-nu-latn
* @tc.desc check the number in en-GB * @tc.desc check the number in zh-u-nu-latn
*/ */
it('formatNumber_test_0200', 0, function () { it('formatNumber_test_0200', 0, function () {
let numfmt = new Intl.NumberFormat('zh-u-nu-latn'); let numfmt = new Intl.NumberFormat('zh-u-nu-latn');
console.log("formatNumber_test_0200 " + numfmt.format(123456.789)); console.log('formatNumber_test_0200 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0300 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0300
* @tc.name format the number in en-GB * @tc.name format the number in zh-u-nu-arab
* @tc.desc check the number in en-GB * @tc.desc check the number in zh-u-nu-arab
*/ */
it('formatNumber_test_0300', 0, function () { it('formatNumber_test_0300', 0, function () {
let numfmt = new Intl.NumberFormat('zh-u-nu-arab'); let numfmt = new Intl.NumberFormat('zh-u-nu-arab');
console.log("formatNumber_test_0300 " + numfmt.format(123456.789)); console.log('formatNumber_test_0300 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩'); expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0400 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0400
* @tc.name format the number in en-GB * @tc.name format the number in en
* @tc.desc check the number in en-GB * @tc.desc check the number in en
*/ */
it('formatNumber_test_0400', 0, function () { it('formatNumber_test_0400', 0, function () {
let numfmt = new Intl.NumberFormat('en'); let numfmt = new Intl.NumberFormat('en');
console.log("formatNumber_test_0400 " + numfmt.format(123456.789)); console.log('formatNumber_test_0400 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0500 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0500
* @tc.name format the number in en-GB * @tc.name format the number in en-u-nu-thai
* @tc.desc check the number in en-GB * @tc.desc check the number in en-u-nu-thai
*/ */
it('formatNumber_test_0500', 0, function () { it('formatNumber_test_0500', 0, function () {
let numfmt = new Intl.NumberFormat('en-u-nu-thai'); let numfmt = new Intl.NumberFormat('en-u-nu-thai');
console.log("formatNumber_test_0500 " + numfmt.format(123456.789)); console.log('formatNumber_test_0500 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('๑๒๓,๔๕๖.๗๘๙'); expect(numfmt.format(123456.789)).assertEqual('๑๒๓,๔๕๖.๗๘๙');
}) })
...@@ -839,106 +839,106 @@ describe('intlTest', function () { ...@@ -839,106 +839,106 @@ describe('intlTest', function () {
*/ */
it('formatNumber_test_0600', 0, function () { it('formatNumber_test_0600', 0, function () {
let numfmt = new Intl.NumberFormat('en-GB'); let numfmt = new Intl.NumberFormat('en-GB');
console.log("formatNumber_test_0600 " + numfmt.format(123456.789)); console.log('formatNumber_test_0600 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0700 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0700
* @tc.name format the number in en-GB * @tc.name format the number in en-US
* @tc.desc check the number in en-GB * @tc.desc check the number in en-US
*/ */
it('formatNumber_test_0700', 0, function () { it('formatNumber_test_0700', 0, function () {
let numfmt = new Intl.NumberFormat('en-US'); let numfmt = new Intl.NumberFormat('en-US');
console.log("formatNumber_test_0700 " + numfmt.format(123456.789)); console.log('formatNumber_test_0700 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0800 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0800
* @tc.name format the number in en-GB * @tc.name format the number in aa
* @tc.desc check the number in en-GB * @tc.desc check the number in aa
*/ */
it('formatNumber_test_0800', 0, function () { it('formatNumber_test_0800', 0, function () {
let numfmt = new Intl.NumberFormat('aa'); let numfmt = new Intl.NumberFormat('aa');
console.log("formatNumber_test_0800 " + numfmt.format(123456.789)); console.log('formatNumber_test_0800 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123456.789'); expect(numfmt.format(123456.789)).assertEqual('123456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0900 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_0900
* @tc.name format the number in en-GB * @tc.name format the number in zh and en list
* @tc.desc check the number in en-GB * @tc.desc check the number in zh and en list
*/ */
it('formatNumber_test_0900', 0, function () { it('formatNumber_test_0900', 0, function () {
let numfmt = new Intl.NumberFormat(['zh','en']); let numfmt = new Intl.NumberFormat(['zh','en']);
console.log("formatNumber_test_0900 " + numfmt.format(123456.789)); console.log('formatNumber_test_0900 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1000 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1000
* @tc.name format the number in en-GB * @tc.name format the number in en and zh list
* @tc.desc check the number in en-GB * @tc.desc check the number in en and zh list
*/ */
it('formatNumber_test_1000', 0, function () { it('formatNumber_test_1000', 0, function () {
let numfmt = new Intl.NumberFormat(['en','zh']); let numfmt = new Intl.NumberFormat(['en','zh']);
console.log("formatNumber_test_1000 " + numfmt.format(123456.789)); console.log('formatNumber_test_1000 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1100 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1100
* @tc.name format the number in en-GB * @tc.name format the number in en and aa list
* @tc.desc check the number in en-GB * @tc.desc check the number in en and aa list
*/ */
it('formatNumber_test_1100', 0, function () { it('formatNumber_test_1100', 0, function () {
let numfmt = new Intl.NumberFormat(['en','aa']); let numfmt = new Intl.NumberFormat(['en','aa']);
console.log("formatNumber_test_1100 " + numfmt.format(123456.789)); console.log('formatNumber_test_1100 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1200 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1200
* @tc.name format the number in en-GB * @tc.name format the number in aa and zh list
* @tc.desc check the number in en-GB * @tc.desc check the number in aa and zh list
*/ */
it('formatNumber_test_1200', 0, function () { it('formatNumber_test_1200', 0, function () {
let numfmt = new Intl.NumberFormat(['aa','zh']); let numfmt = new Intl.NumberFormat(['aa','zh']);
console.log("formatNumber_test_1200 " + numfmt.format(123456.789)); console.log('formatNumber_test_1200 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789'); expect(numfmt.format(123456.789)).assertEqual('123,456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1300 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1300
* @tc.name format the number in en-GB * @tc.name format the number in aa and bb list
* @tc.desc check the number in en-GB * @tc.desc check the number in aa and bb list
*/ */
it('formatNumber_test_1300', 0, function () { it('formatNumber_test_1300', 0, function () {
let numfmt = new Intl.NumberFormat(['aa','bb']); let numfmt = new Intl.NumberFormat(['aa','bb']);
console.log("formatNumber_test_1300 " + numfmt.format(123456.789)); console.log('formatNumber_test_1300 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123456.789'); expect(numfmt.format(123456.789)).assertEqual('123456.789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1400 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1400
* @tc.name format the number in en-GB * @tc.name format the number in aa bb and es list
* @tc.desc check the number in en-GB * @tc.desc check the number in aa bb and es list
*/ */
it('formatNumber_test_1400', 0, function () { it('formatNumber_test_1400', 0, function () {
let numfmt = new Intl.NumberFormat(['aa','bb','es']); let numfmt = new Intl.NumberFormat(['aa','bb','es']);
console.log("formatNumber_test_1400 " + numfmt.format(123456.789)); console.log('formatNumber_test_1400 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123.456,789'); expect(numfmt.format(123456.789)).assertEqual('123.456,789');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1500 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1500
* @tc.name format the number in en-GB * @tc.name format the number in aa it and bb list
* @tc.desc check the number in en-GB * @tc.desc check the number in aa it and bb list
*/ */
it('formatNumber_test_1500', 0, function () { it('formatNumber_test_1500', 0, function () {
let numfmt = new Intl.NumberFormat(['aa','it','bb']); let numfmt = new Intl.NumberFormat(['aa','it','bb']);
console.log("formatNumber_test_1500 " + numfmt.format(123456.789)); console.log('formatNumber_test_1500 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123.456,789'); expect(numfmt.format(123456.789)).assertEqual('123.456,789');
}) })
...@@ -949,7 +949,7 @@ describe('intlTest', function () { ...@@ -949,7 +949,7 @@ describe('intlTest', function () {
*/ */
it('formatNumber_test_1600', 0, function () { it('formatNumber_test_1600', 0, function () {
let numfmt = new Intl.NumberFormat('en-GB', { style: 'decimal', notation: 'scientific' }); let numfmt = new Intl.NumberFormat('en-GB', { style: 'decimal', notation: 'scientific' });
console.log("formatNumber_test_1600 " + numfmt.format(123456.789)); console.log('formatNumber_test_1600 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('1.234568E5'); expect(numfmt.format(123456.789)).assertEqual('1.234568E5');
expect(numfmt.resolvedOptions().style).assertEqual('decimal'); expect(numfmt.resolvedOptions().style).assertEqual('decimal');
expect(numfmt.resolvedOptions().notation).assertEqual('scientific'); expect(numfmt.resolvedOptions().notation).assertEqual('scientific');
...@@ -957,13 +957,13 @@ describe('intlTest', function () { ...@@ -957,13 +957,13 @@ describe('intlTest', function () {
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1700 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1700
* @tc.name format the number with currency * @tc.name format the number with currency EUR
* @tc.desc check the number with currency * @tc.desc check the number with currency EUR
*/ */
it('formatNumber_test_1700', 0, function () { it('formatNumber_test_1700', 0, function () {
let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR', let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR',
currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always' }); currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always' });
console.log("formatNumber_test_1700 " + numfmt.format(123456.789)); console.log('formatNumber_test_1700 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('+123,456.79 euros'); expect(numfmt.format(123456.789)).assertEqual('+123,456.79 euros');
expect(numfmt.resolvedOptions().locale).assertEqual('en-GB'); expect(numfmt.resolvedOptions().locale).assertEqual('en-GB');
expect(numfmt.resolvedOptions().style).assertEqual('currency'); expect(numfmt.resolvedOptions().style).assertEqual('currency');
...@@ -975,50 +975,50 @@ describe('intlTest', function () { ...@@ -975,50 +975,50 @@ describe('intlTest', function () {
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1800 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1800
* @tc.name format the number with currency * @tc.name format the number with currency USD
* @tc.desc check the number with currency * @tc.desc check the number with currency USD
*/ */
it('formatNumber_test_1800', 0, function () { it('formatNumber_test_1800', 0, function () {
let numfmt = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', let numfmt = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD',
currencyDisplay: 'code', currencySign: 'accounting', signDisplay: 'always' }); currencyDisplay: 'code', currencySign: 'accounting', signDisplay: 'always' });
console.log("formatNumber_test_1800 " + numfmt.format(123456.789)); console.log('formatNumber_test_1800 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('+USD 123,456.79'); expect(numfmt.format(123456.789)).assertEqual('+USD 123,456.79');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1900 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_1900
* @tc.name format the number with currency * @tc.name format the number with currency CNY
* @tc.desc check the number with currency * @tc.desc check the number with currency CNY
*/ */
it('formatNumber_test_1900', 0, function () { it('formatNumber_test_1900', 0, function () {
let numfmt = new Intl.NumberFormat('zh-CN', { style: 'currency', currency: 'CNY', let numfmt = new Intl.NumberFormat('zh-CN', { style: 'currency', currency: 'CNY',
currencyDisplay: 'symbol', currencySign: 'accounting', signDisplay: 'always' }); currencyDisplay: 'symbol', currencySign: 'accounting', signDisplay: 'always' });
console.log("formatNumber_test_1900 " + numfmt.format(123456.789)); console.log('formatNumber_test_1900 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('+¥123,456.79'); expect(numfmt.format(123456.789)).assertEqual('+¥123,456.79');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_2000 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_2000
* @tc.name format the number with currency * @tc.name format the number with currency JPY
* @tc.desc check the number with currency * @tc.desc check the number with currency JPY
*/ */
it('formatNumber_test_2000', 0, function () { it('formatNumber_test_2000', 0, function () {
let numfmt = new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY', let numfmt = new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY',
currencyDisplay: 'narrowSymbol', currencySign: 'accounting', signDisplay: 'always' }); currencyDisplay: 'narrowSymbol', currencySign: 'accounting', signDisplay: 'always' });
console.log("formatNumber_test_2000 " + numfmt.format(123456.789)); console.log('formatNumber_test_2000 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('+¥123,457'); expect(numfmt.format(123456.789)).assertEqual('+¥123,457');
}) })
/* * /* *
* @tc.number SUB_GLOBAL_I18N_JS_NUMBER_2100 * @tc.number SUB_GLOBAL_I18N_JS_NUMBER_2100
* @tc.name format the number with currency * @tc.name format the number with signDisplay
* @tc.desc check the number with currency * @tc.desc check the number with signDisplay
*/ */
it('formatNumber_test_2100', 0, function () { it('formatNumber_test_2100', 0, function () {
let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR', let numfmt = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR',
currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always', currencyDisplay: 'name', currencySign: 'accounting', signDisplay: 'always',
notation: 'compact', compactDisplay: 'long', localeMatcher: 'lookup' }); notation: 'compact', compactDisplay: 'long', localeMatcher: 'lookup' });
console.log("formatNumber_test_2100 " + numfmt.format(123456.789)); console.log('formatNumber_test_2100 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('+123 thousand euros'); expect(numfmt.format(123456.789)).assertEqual('+123 thousand euros');
expect(numfmt.resolvedOptions().locale).assertEqual('en-GB'); expect(numfmt.resolvedOptions().locale).assertEqual('en-GB');
expect(numfmt.resolvedOptions().style).assertEqual('currency'); expect(numfmt.resolvedOptions().style).assertEqual('currency');
...@@ -1038,7 +1038,7 @@ describe('intlTest', function () { ...@@ -1038,7 +1038,7 @@ describe('intlTest', function () {
it('formatNumber_test_2200', 0, function () { it('formatNumber_test_2200', 0, function () {
let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter', let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
unitDisplay: 'long', maximumFractionDigits: 2, minimumIntegerDigits: 7 }); unitDisplay: 'long', maximumFractionDigits: 2, minimumIntegerDigits: 7 });
console.log("formatNumber_test_2200 " + numfmt.format(123456.789)); console.log('formatNumber_test_2200 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('0,123,456.79米'); expect(numfmt.format(123456.789)).assertEqual('0,123,456.79米');
expect(numfmt.resolvedOptions().style).assertEqual('unit'); expect(numfmt.resolvedOptions().style).assertEqual('unit');
expect(numfmt.resolvedOptions().unit).assertEqual('meter'); expect(numfmt.resolvedOptions().unit).assertEqual('meter');
...@@ -1053,7 +1053,7 @@ describe('intlTest', function () { ...@@ -1053,7 +1053,7 @@ describe('intlTest', function () {
it('formatNumber_test_2300', 0, function () { it('formatNumber_test_2300', 0, function () {
let numfmt = new Intl.NumberFormat('en-CN', { style: 'percent', maximumFractionDigits: 2, let numfmt = new Intl.NumberFormat('en-CN', { style: 'percent', maximumFractionDigits: 2,
minimumIntegerDigits: 7 }); minimumIntegerDigits: 7 });
console.log("formatNumber_test_2300 " + numfmt.format(123456.789)); console.log('formatNumber_test_2300 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('0,123,456.79%'); expect(numfmt.format(123456.789)).assertEqual('0,123,456.79%');
}) })
...@@ -1064,7 +1064,7 @@ describe('intlTest', function () { ...@@ -1064,7 +1064,7 @@ describe('intlTest', function () {
*/ */
it('formatNumber_test_2400', 0, function () { it('formatNumber_test_2400', 0, function () {
let numfmt = new Intl.NumberFormat('ar-EG', { numberingSystem: 'arab' }); let numfmt = new Intl.NumberFormat('ar-EG', { numberingSystem: 'arab' });
console.log("formatNumber_test_2400 " + numfmt.format(123456.789)); console.log('formatNumber_test_2400 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩'); expect(numfmt.format(123456.789)).assertEqual('١٢٣٬٤٥٦٫٧٨٩');
expect(numfmt.resolvedOptions().numberingSystem).assertEqual('arab'); expect(numfmt.resolvedOptions().numberingSystem).assertEqual('arab');
}) })
...@@ -1077,7 +1077,7 @@ describe('intlTest', function () { ...@@ -1077,7 +1077,7 @@ describe('intlTest', function () {
it('formatNumber_test_2500', 0, function () { it('formatNumber_test_2500', 0, function () {
let numfmt = new Intl.NumberFormat('ar', { style: 'percent', minimumFractionDigits: 1, maximumFractionDigits: 2, let numfmt = new Intl.NumberFormat('ar', { style: 'percent', minimumFractionDigits: 1, maximumFractionDigits: 2,
minimumIntegerDigits: 7, minimumSignificantDigits: 5, maximumSignificantDigits: 10, useGrouping: true }); minimumIntegerDigits: 7, minimumSignificantDigits: 5, maximumSignificantDigits: 10, useGrouping: true });
console.log("formatNumber_test_2500 " + numfmt.resolvedOptions().style); console.log('formatNumber_test_2500 ' + numfmt.resolvedOptions().style);
expect(numfmt.resolvedOptions().style).assertEqual('percent'); expect(numfmt.resolvedOptions().style).assertEqual('percent');
expect(numfmt.resolvedOptions().minimumFractionDigits).assertEqual(1); expect(numfmt.resolvedOptions().minimumFractionDigits).assertEqual(1);
expect(numfmt.resolvedOptions().maximumFractionDigits).assertEqual(2); expect(numfmt.resolvedOptions().maximumFractionDigits).assertEqual(2);
...@@ -1086,5 +1086,5 @@ describe('intlTest', function () { ...@@ -1086,5 +1086,5 @@ describe('intlTest', function () {
expect(numfmt.resolvedOptions().maximumSignificantDigits).assertEqual(10); expect(numfmt.resolvedOptions().maximumSignificantDigits).assertEqual(10);
expect(numfmt.resolvedOptions().useGrouping === true).assertTrue(); expect(numfmt.resolvedOptions().useGrouping === true).assertTrue();
}) })
console.log("*************end I18NTest*************"); console.log('*************end I18NTest*************');
}) })
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册