未验证 提交 1e90ebb8 编写于 作者: O openharmony_ci 提交者: Gitee

!2975 add narrow param

Merge pull request !2975 from 杨清/1228
......@@ -1625,6 +1625,22 @@ describe('I18nTest', function () {
'en-US',
'medium');
console.log('i18n_test_9200 ' + value);
expect(value).assertEqual('236.588 L');
})
/**
* @tc.number SUB_GLOBAL_I18N_JS_9250
* @tc.name test unitConvert interface from cup to liter unit with narrow style
* @tc.desc get the unitConvert value
*/
it('i18n_test_9250', 0, function () {
console.log('i18n_test_9250 ' + 'start');
let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'},
{unit: 'liter', measureSystem: 'SI'},
1000,
'en-US',
'narrow');
console.log('i18n_test_9250 ' + value);
expect(value).assertEqual('236.588L');
})
......
......@@ -1095,19 +1095,6 @@ describe('intlTest', function () {
expect(numfmt.format(123456.789)).assertEqual('+¥123,457');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2250
* @tc.name format the number with unitUsage
* @tc.desc check the number with unitUsage
*/
it('formatNumber_test_2250', 0, function () {
let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
unitDisplay: 'long', unitUsage: 'length-road' });
console.log('formatNumber_test_2250 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2100
* @tc.name format the number with signDisplay
......@@ -1144,6 +1131,71 @@ describe('intlTest', function () {
expect(numfmt.resolvedOptions().unitDisplay).assertEqual('long');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2250
* @tc.name format the number with unitUsage
* @tc.desc check the number with unitUsage
*/
it('formatNumber_test_2250', 0, function () {
let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
unitDisplay: 'long', unitUsage: 'length-road' });
console.log('formatNumber_test_2250 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2260
* @tc.name format the number with narrow value in unitUsage param
* @tc.desc check the number with unitUsage
*/
it('formatNumber_test_2260', 0, function () {
let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
unitDisplay: 'narrow', unitUsage: 'length-road' });
console.log('formatNumber_test_2260 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2270
* @tc.name format the number with short value in unitUsage param
* @tc.desc check the number with unitUsage
*/
it('formatNumber_test_2270', 0, function () {
let numfmt = new Intl.NumberFormat('zh-CN', { style: 'unit', unit: 'meter',
unitDisplay: 'short', unitUsage: 'length-road' });
console.log('formatNumber_test_2270 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('123,456.789米');
expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2280
* @tc.name format the number with narrow value in unitUsage param
* @tc.desc check the number with unitUsage
*/
it('formatNumber_test_2280', 0, function () {
let numfmt = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'meter',
unitDisplay: 'narrow', unitUsage: 'length-road' });
console.log('formatNumber_test_2280 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('76.712mi');
expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2290
* @tc.name format the number with short value in unitUsage param
* @tc.desc check the number with unitUsage
*/
it('formatNumber_test_2290', 0, function () {
let numfmt = new Intl.NumberFormat('en-US', { style: 'unit', unit: 'meter',
unitDisplay: 'short', unitUsage: 'length-road' });
console.log('formatNumber_test_2290 ' + numfmt.format(123456.789));
expect(numfmt.format(123456.789)).assertEqual('76.712 mi');
expect(numfmt.resolvedOptions().unitUsage).assertEqual('length-road');
})
/* *
* @tc.number SUB_GLOBAL_INTL_JS_NUMBER_2300
* @tc.name format the number with percetn style
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册