Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8740ca07
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8740ca07
编写于
8月 07, 2021
作者:
Y
y00314596
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify testcases,20210807,yangqing3@huawei.com
Signed-off-by:
N
y00314596
<
yangqing3@huawei.com
>
上级
2dfbfbee
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
141 addition
and
2 deletion
+141
-2
global/i18n_standard/intljs/hap/entry-release-signed.hap
global/i18n_standard/intljs/hap/entry-release-signed.hap
+0
-0
global/i18n_standard/intljs/project/entry/src/main/js/test/I18n.test.js
...andard/intljs/project/entry/src/main/js/test/I18n.test.js
+141
-2
未找到文件。
global/i18n_standard/intljs/hap/entry-release-signed.hap
浏览文件 @
8740ca07
无法预览此类型文件
global/i18n_standard/intljs/project/entry/src/main/js/test/I18n.test.js
浏览文件 @
8740ca07
...
...
@@ -144,6 +144,59 @@ describe('intlTest', function () {
expect
(
locale
.
collation
).
assertEqual
(
"
big5han
"
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_1101
* @tc.name test the toString interface
* @tc.desc check the toString method
*/
it
(
'
locale_test_012
'
,
0
,
function
()
{
var
locale
=
new
Intl
.
Locale
(
'
zh-CN
'
,
{
calendar
:
'
gregory
'
,
collation
:
'
compact
'
});
expect
(
locale
.
toString
()).
assertEqual
(
"
zh-CN-u-ca-gregory-co-compact
"
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_1102
* @tc.name test the maximize interface
* @tc.desc check the maximize method
*/
it
(
'
locale_test_013
'
,
0
,
function
()
{
var
locale
=
new
Intl
.
Locale
(
'
zh
'
,
{
calendar
:
'
gregory
'
,
collation
:
'
compact
'
});
console
.
log
(
"
jessie 013
"
+
locale
.
maximize
().
toString
());
expect
(
locale
.
maximize
().
toString
()).
assertEqual
(
"
zh-hans-CN-u-ca-gregory-co-compact
"
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_1103
* @tc.name test the mininize interface
* @tc.desc check the mininize method
*/
it
(
'
locale_test_014
'
,
0
,
function
()
{
var
locale
=
new
Intl
.
Locale
(
'
zh-hans-CN
'
,
{
calendar
:
'
gregory
'
,
collation
:
'
compact
'
});
console
.
log
(
"
jessie 014
"
+
locale
.
mininize
().
toString
());
expect
(
locale
.
mininize
().
toString
()).
assertEqual
(
"
zh-u-ca-gregory-co-compact
"
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_1104
* @tc.name format the numeric
* @tc.desc check the numeric
*/
it
(
'
locale_test_015
'
,
0
,
function
()
{
var
locale
=
new
Intl
.
Locale
(
'
ja-Jpan-JP
'
,
{
numeric
:
true
});
console
.
log
(
"
jessie 015
"
+
locale
.
numeric
);
expect
(
locale
.
numeric
==
true
).
assertTrue
();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_1105
* @tc.name format the numeric
* @tc.desc check the numeric
*/
it
(
'
locale_test_016
'
,
0
,
function
()
{
var
locale
=
new
Intl
.
Locale
(
'
ja-Jpan-JP
'
,
{
numberingSystem
:
'
arab
'
});
expect
(
locale
.
numberingSystem
).
assertEqual
(
"
arab
"
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_1200
* @tc.name format the datetime with en-GB locale
...
...
@@ -336,6 +389,43 @@ describe('intlTest', function () {
expect
(
datefmt
.
format
(
date
)).
assertEqual
(
'
dimanche ᠒᠐ décembre ᠒᠐᠒᠐
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_2701
* @tc.name format the hour
* @tc.desc check the hour
*/
it
(
'
formatDateTimeFormat_test_016
'
,
0
,
function
()
{
var
date
=
new
Date
(
2020
,
11
,
20
,
14
,
23
,
16
);
var
option
=
{
dateStyle
:
'
full
'
};
var
datefmt
=
new
Intl
.
DateTimeFormat
([
'
ban
'
,
'
zh
'
],
option
);
expect
(
datefmt
.
format
(
date
)).
assertEqual
(
'
2020年12月20日星期日
'
);
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_2702
* @tc.name format the hour
* @tc.desc check the hour
*/
it
(
'
formatDateTimeFormat_test_017
'
,
0
,
function
()
{
var
option
=
{
year
:
'
numeric
'
,
month
:
'
long
'
,
day
:
'
numeric
'
,
hour
:
'
numeric
'
,
minute
:
'
2-digit
'
,
second
:
'
numeric
'
,
weekday
:
'
long
'
,
era
:
'
short
'
,
hourCycle
:
'
h24
'
,
numberingSystem
:
'
arab
'
,
hour12
:
true
,
dayPeriod
:
'
short
'
,
foramtMatcher
:
'
basic
'
,
localeMatcher
:
'
lookup
'
};
var
datefmt
=
new
Intl
.
DateTimeFormat
(
'
zh-CN-u-hc-h12
'
,
option
);
expect
(
datefmt
.
resolvedOptions
().
locale
).
assertEqual
(
'
zh-CN
'
);
expect
(
datefmt
.
resolvedOptions
().
hourCycle
).
assertEqual
(
'
h24
'
);
expect
(
datefmt
.
resolvedOptions
().
numberingSystem
).
assertEqual
(
'
arab
'
);
expect
(
datefmt
.
resolvedOptions
().
hour12
==
true
).
assertTrue
();
expect
(
datefmt
.
resolvedOptions
().
era
).
assertEqual
(
'
short
'
);
expect
(
datefmt
.
resolvedOptions
().
month
).
assertEqual
(
'
long
'
);
expect
(
datefmt
.
resolvedOptions
().
day
).
assertEqual
(
'
numeric
'
);
expect
(
datefmt
.
resolvedOptions
().
minute
).
assertEqual
(
'
2-digit
'
);
expect
(
datefmt
.
resolvedOptions
().
second
).
assertEqual
(
'
numeric
'
);
expect
(
datefmt
.
resolvedOptions
().
dayPeriod
).
assertEqual
(
'
short
'
);
// expect(datefmt.resolvedOptions().foramtMatcher).assertEqual('basic');
// expect(datefmt.resolvedOptions().localeMatcher).assertEqual('lookup');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_2800
* @tc.name format the number in en-GB
...
...
@@ -356,6 +446,8 @@ describe('intlTest', function () {
var
numfmt
=
new
Intl
.
NumberFormat
(
'
en-GB
'
,
{
style
:
'
decimal
'
,
notation
:
'
scientific
'
});
console
.
log
(
"
jessie
"
+
numfmt
.
format
(
123456.789
));
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
1.234568E5
'
);
expect
(
numfmt
.
resolvedOptions
().
style
).
assertEqual
(
'
decimal
'
);
expect
(
numfmt
.
resolvedOptions
().
notation
).
assertEqual
(
'
scientific
'
);
})
/* *
...
...
@@ -368,6 +460,33 @@ describe('intlTest', function () {
currencyDisplay
:
'
name
'
,
currencySign
:
'
accounting
'
,
signDisplay
:
'
always
'
});
console
.
log
(
"
jessie
"
+
numfmt
.
format
(
123456.789
));
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
+123,456.79 euros
'
);
expect
(
numfmt
.
resolvedOptions
().
locale
).
assertEqual
(
'
en-GB
'
);
expect
(
numfmt
.
resolvedOptions
().
style
).
assertEqual
(
'
currency
'
);
expect
(
numfmt
.
resolvedOptions
().
currency
).
assertEqual
(
'
EUR
'
);
expect
(
numfmt
.
resolvedOptions
().
currencyDisplay
).
assertEqual
(
'
name
'
);
expect
(
numfmt
.
resolvedOptions
().
currencySign
).
assertEqual
(
'
accounting
'
);
// expect(numfmt.resolvedOptions().signDisplay).assertEqual('always');
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_3001
* @tc.name format the number with currency
* @tc.desc check the number with currency
*/
it
(
'
formatNumber_test_00301
'
,
0
,
function
()
{
var
numfmt
=
new
Intl
.
NumberFormat
(
'
en-GB
'
,
{
style
:
'
currency
'
,
currency
:
'
EUR
'
,
currencyDisplay
:
'
name
'
,
currencySign
:
'
accounting
'
,
signDisplay
:
'
always
'
,
notation
:
'
compact
'
,
compactDisplay
:
'
long
'
,
localeMatcher
:
'
lookup
'
});
console
.
log
(
"
jessie
"
+
numfmt
.
format
(
123456.789
));
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
+123 thousand euros
'
);
expect
(
numfmt
.
resolvedOptions
().
locale
).
assertEqual
(
'
en-GB
'
);
expect
(
numfmt
.
resolvedOptions
().
style
).
assertEqual
(
'
currency
'
);
expect
(
numfmt
.
resolvedOptions
().
currency
).
assertEqual
(
'
EUR
'
);
expect
(
numfmt
.
resolvedOptions
().
currencyDisplay
).
assertEqual
(
'
name
'
);
expect
(
numfmt
.
resolvedOptions
().
currencySign
).
assertEqual
(
'
accounting
'
);
expect
(
numfmt
.
resolvedOptions
().
compactDisplay
).
assertEqual
(
'
long
'
);
expect
(
numfmt
.
resolvedOptions
().
localeMatcher
).
assertEqual
(
'
lookup
'
);
// expect(numfmt.resolvedOptions().signDisplay).assertEqual('always');
})
/* *
...
...
@@ -380,6 +499,9 @@ describe('intlTest', function () {
unitDisplay
:
'
long
'
,
maximumFractionDigits
:
2
,
minimumIntegerDigits
:
7
});
console
.
log
(
"
jessie
"
+
numfmt
.
format
(
123456.789
));
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
0,123,456.79米
'
);
expect
(
numfmt
.
resolvedOptions
().
style
).
assertEqual
(
'
unit
'
);
expect
(
numfmt
.
resolvedOptions
().
unit
).
assertEqual
(
'
meter
'
);
expect
(
numfmt
.
resolvedOptions
().
unitDisplay
).
assertEqual
(
'
long
'
);
})
/* *
...
...
@@ -403,6 +525,7 @@ describe('intlTest', function () {
var
numfmt
=
new
Intl
.
NumberFormat
(
'
ar-EG
'
,
{
numberingSystem
:
'
arab
'
});
console
.
log
(
"
jessie
"
+
numfmt
.
format
(
123456.789
));
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
١٢٣٬٤٥٦٫٧٨٩
'
);
expect
(
numfmt
.
resolvedOptions
().
numberingSystem
).
assertEqual
(
'
arab
'
);
})
/* *
...
...
@@ -411,12 +534,28 @@ describe('intlTest', function () {
* @tc.desc check the number with style
*/
it
(
'
formatNumber_test_007
'
,
0
,
function
()
{
var
numfmt
=
new
Intl
.
NumberFormat
(
'
ar
'
,
{
style
:
'
percent
'
,
maximumFractionDigits
:
2
,
minimumIntegerDigits
:
7
});
var
numfmt
=
new
Intl
.
NumberFormat
(
'
ar
'
,
{
style
:
'
percent
'
,
m
inimumFractionDigits
:
1
,
m
aximumFractionDigits
:
2
,
minimumIntegerDigits
:
7
,
minimumSignificantDigits
:
5
,
maximumSignificantDigits
:
10
,
useGrouping
:
true
});
console
.
log
(
"
jessie
"
+
numfmt
.
resolvedOptions
().
style
);
expect
(
numfmt
.
resolvedOptions
().
style
).
assertEqual
(
'
percent
'
);
expect
(
numfmt
.
resolvedOptions
().
minimumFractionDigits
).
assertEqual
(
1
);
expect
(
numfmt
.
resolvedOptions
().
maximumFractionDigits
).
assertEqual
(
2
);
expect
(
numfmt
.
resolvedOptions
().
minimumIntegerDigits
).
assertEqual
(
7
);
expect
(
numfmt
.
resolvedOptions
().
minimumSignificantDigits
).
assertEqual
(
5
);
expect
(
numfmt
.
resolvedOptions
().
maximumSignificantDigits
).
assertEqual
(
10
);
expect
(
numfmt
.
resolvedOptions
().
useGrouping
==
true
).
assertTrue
();
})
/* *
* @tc.number SUB_GLOBAL_I18N_JS_3500
* @tc.name format the number with style
* @tc.desc check the number with style
*/
it
(
'
formatNumber_test_008
'
,
0
,
function
()
{
var
numfmt
=
new
Intl
.
NumberFormat
([
'
test
'
,
'
zh-CN
'
],
{
style
:
'
unit
'
,
unit
:
'
meter
'
,
unitDisplay
:
'
long
'
,
maximumFractionDigits
:
2
,
minimumIntegerDigits
:
7
});
console
.
log
(
"
jessie
"
+
numfmt
.
format
(
123456.789
));
expect
(
numfmt
.
format
(
123456.789
)).
assertEqual
(
'
0,123,456.79米
'
);
})
console
.
log
(
"
*************00000000000000000000000*************
"
);
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录