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

!3007 add narrow param to 3.1 rls

Merge pull request !3007 from 杨清/cherry-pick-1650423638
...@@ -1625,6 +1625,22 @@ describe('I18nTest', function () { ...@@ -1625,6 +1625,22 @@ describe('I18nTest', function () {
'en-US', 'en-US',
'medium'); 'medium');
console.log('i18n_test_9200 ' + value); 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'); expect(value).assertEqual('236.588L');
}) })
......
...@@ -1095,19 +1095,6 @@ describe('intlTest', function () { ...@@ -1095,19 +1095,6 @@ describe('intlTest', function () {
expect(numfmt.format(123456.789)).assertEqual('+¥123,457'); 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.number SUB_GLOBAL_INTL_JS_NUMBER_2100
* @tc.name format the number with signDisplay * @tc.name format the number with signDisplay
...@@ -1144,6 +1131,71 @@ describe('intlTest', function () { ...@@ -1144,6 +1131,71 @@ describe('intlTest', function () {
expect(numfmt.resolvedOptions().unitDisplay).assertEqual('long'); 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.number SUB_GLOBAL_INTL_JS_NUMBER_2300
* @tc.name format the number with percetn style * @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.
先完成此消息的编辑!
想要评论请 注册