diff --git a/global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js b/global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js index 6b4c9e05c426a5b387959fc1aeec07c0ab198b77..dede972e83da79703cf08d563432ddbd099a0d0d 100755 --- a/global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js +++ b/global/i18n_standard/intljs/src/main/js/default/test/I18n.test.js @@ -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'); }) diff --git a/global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js b/global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js index eb2203d70500fa7517c8093f1553a4687df2fdec..47a68f189a79a00d1f0f1c195ee615c12ebf91a4 100755 --- a/global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js +++ b/global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js @@ -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