Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1205a042
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看板
未验证
提交
1205a042
编写于
1月 18, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1613 新增js测试类
Merge pull request !1613 from zj/master
上级
0b26e910
4f1752dd
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
500 addition
and
2 deletion
+500
-2
ace/ace_standard/src/main/config.json
ace/ace_standard/src/main/config.json
+5
-1
ace/ace_standard/src/main/js/default/pages/button/index.css
ace/ace_standard/src/main/js/default/pages/button/index.css
+78
-0
ace/ace_standard/src/main/js/default/pages/button/index.hml
ace/ace_standard/src/main/js/default/pages/button/index.hml
+46
-0
ace/ace_standard/src/main/js/default/pages/button/index.js
ace/ace_standard/src/main/js/default/pages/button/index.js
+34
-0
ace/ace_standard/src/main/js/default/pages/chart/index.css
ace/ace_standard/src/main/js/default/pages/chart/index.css
+22
-0
ace/ace_standard/src/main/js/default/pages/chart/index.hml
ace/ace_standard/src/main/js/default/pages/chart/index.hml
+7
-0
ace/ace_standard/src/main/js/default/pages/chart/index.js
ace/ace_standard/src/main/js/default/pages/chart/index.js
+64
-0
ace/ace_standard/src/main/js/default/pages/input/index.css
ace/ace_standard/src/main/js/default/pages/input/index.css
+13
-0
ace/ace_standard/src/main/js/default/pages/input/index.hml
ace/ace_standard/src/main/js/default/pages/input/index.hml
+8
-0
ace/ace_standard/src/main/js/default/pages/input/index.js
ace/ace_standard/src/main/js/default/pages/input/index.js
+35
-0
ace/ace_standard/src/main/js/default/pages/slider/index.css
ace/ace_standard/src/main/js/default/pages/slider/index.css
+8
-0
ace/ace_standard/src/main/js/default/pages/slider/index.hml
ace/ace_standard/src/main/js/default/pages/slider/index.hml
+7
-0
ace/ace_standard/src/main/js/default/pages/slider/index.js
ace/ace_standard/src/main/js/default/pages/slider/index.js
+35
-0
ace/ace_standard/src/main/js/default/test/List.test.js
ace/ace_standard/src/main/js/default/test/List.test.js
+2
-1
ace/ace_standard/src/main/js/default/test/commonComponentJsApi.test.js
...ard/src/main/js/default/test/commonComponentJsApi.test.js
+136
-0
未找到文件。
ace/ace_standard/src/main/config.json
浏览文件 @
1205a042
...
...
@@ -51,7 +51,11 @@
"pages"
:
[
"pages/index/index"
,
"pages/routerPush/index"
,
"pages/routerReplace/index"
"pages/routerReplace/index"
,
"pages/button/index"
,
"pages/chart/index"
,
"pages/input/index"
,
"pages/slider/index"
],
"name"
:
"default"
,
"window"
:
{
...
...
ace/ace_standard/src/main/js/default/pages/button/index.css
0 → 100644
浏览文件 @
1205a042
.div-button
{
flex-direction
:
column
;
width
:
100%
;
}
.circleall
{
width
:
90%
;
flex-direction
:
row
;
justify-content
:
space-around
;
margin-left
:
4%
;
}
.circlealls
{
flex-direction
:
row
;
}
.buttons
{
margin-top
:
15px
;
width
:
45%
;
height
:
45px
;
text-align
:
center
;
font-size
:
14px
;
border-radius
:
10px
;
background-color
:
#317aff
;
}
.title
{
font-size
:
13px
;
margin-top
:
60px
;
margin-left
:
20px
;
color
:
grey
;
}
.all
{
flex-direction
:
column
;
align-items
:
center
;
margin-bottom
:
20px
;
}
.oriage
{
background-color
:
#ee8443
;
}
.white
{
opacity
:
0.4
;
}
.icon
{
icon-height
:
30px
;
icon-width
:
30px
;
}
.warn
{
background-color
:
#f55a42
;
}
.circle
{
radius
:
30px
;
icon-width
:
30px
;
icon-height
:
30px
;
margin-left
:
20px
;
margin-top
:
20px
;
background-color
:
#317aff
;
}
.cir
{
background-color
:
#f55a42
;
}
.text
{
text-color
:
#0a59f7
;
font-size
:
17px
;
font-weight
:
600
;
font-family
:
sans-serif
;
font-style
:
normal
;
}
.text1
{
text-color
:
#969696
;
}
.text2
{
text-color
:
#e84026
;
}
.download
{
margin-top
:
15px
;
width
:
88%
;
height
:
45px
;
border-radius
:
50px
;
text-color
:
white
;
background-color
:
#007dff
;
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/button/index.hml
0 → 100644
浏览文件 @
1205a042
<div class="div-button">
<text class="title">普通按钮</text>
<div class="circleall">
<button class="buttons">确认按钮</button>
<button class="buttons" waiting="true">Loading</button>
</div>
<div class="circleall">
<button class="buttons icon" icon="/common/images/paobu.png" value="跑步" placement="start"></button>
<button class="buttons white">禁用按钮</button>
</div>
<div class="circleall">
<button class="buttons oriage">重置</button>
<button class="buttons warn">告警按钮</button>
</div>
<text class="title">胶囊按钮</text>
<div class="circleall">
<button class="buttons" type="capsule">确认按钮</button>
<button class="buttons" type="capsule" waiting="true">Loading</button>
</div>
<div class="circleall">
<button class="buttons" type="capsule">清除</button>
<button class="buttons white" type="capsule" >禁用按钮</button>
</div>
<div class="circleall">
<button class="buttons oriage" type="capsule">重置</button>
<button class="buttons warn" type="capsule">告警按钮</button>
</div>
<text class="title">圆形按钮</text>
<div class="circlealls">
<button class="circle" type="circle" icon="/common/images/fenleifuben.png">icon按钮</button>
<button class="circle cir" type="circle" icon="/common/images/rest-fill.png">icon按钮</button>
</div>
<text class="title">文本按钮</text>
<div class="circleall">
<button class="text" type="text">文本按钮1</button>
<button class="text text1" type="text">文本按钮2</button>
<button class="text text2" type="text">文本按钮3</button>
</div>
<text class="title">长胶囊按钮</text>
<div class="all">
<button class="download" type="download">下载按钮</button>
<button class="download white" type="download">禁止下载</button>
<button class="download" type="download" id="download-btn"
onclick="setProgress">{{downloadText}}</button>
</div>
</div>
ace/ace_standard/src/main/js/default/pages/button/index.js
0 → 100644
浏览文件 @
1205a042
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
data
:
{
progress
:
10
,
downloadText
:
"
进度条按钮
"
},
setProgress
(
e
)
{
var
i
=
0
var
set
=
setInterval
(()
=>
{
i
+=
10
this
.
progress
=
i
this
.
downloadText
=
this
.
progress
+
"
%
"
;
this
.
$element
(
'
download-btn
'
).
setProgress
({
progress
:
this
.
progress
});
if
(
this
.
progress
>=
100
){
clearInterval
(
set
)
this
.
downloadText
=
"
完成
"
}
},
1000
)
},
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/chart/index.css
0 → 100644
浏览文件 @
1205a042
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.chart-region
{
height
:
400px
;
width
:
700px
;
}
.chart-background
{
object-fit
:
fill
;
}
.chart-data
{
width
:
700px
;
height
:
600px
;
}
button
{
width
:
100%
;
height
:
50px
;
background-color
:
#F4F2F1
;
text-color
:
#0C81F3
;
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/chart/index.hml
0 → 100644
浏览文件 @
1205a042
<div class="container">
<stack class="chart-region">
<image class="chart-background" src="common/background.png"></image>
<chart class="chart-data" type="line" ref="linechart" options="{{lineOps}}" datasets="{{lineData}}"></chart>
</stack>
<button value="Add data" onclick="addData"></button>
</div>
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/chart/index.js
0 → 100644
浏览文件 @
1205a042
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
data
:
{
lineData
:
[
{
strokeColor
:
'
#0081ff
'
,
fillColor
:
'
#cce5ff
'
,
data
:
[
763
,
550
,
551
,
554
,
731
,
654
,
525
,
696
,
595
,
628
,
791
,
505
,
613
,
575
,
475
,
553
,
491
,
680
,
657
,
716
],
gradient
:
true
,
}
],
lineOps
:
{
xAxis
:
{
min
:
0
,
max
:
20
,
display
:
false
,
},
yAxis
:
{
min
:
0
,
max
:
1000
,
display
:
false
,
},
series
:
{
lineStyle
:
{
width
:
"
5px
"
,
smooth
:
true
,
},
headPoint
:
{
shape
:
"
circle
"
,
size
:
20
,
strokeWidth
:
5
,
fillColor
:
'
#ffffff
'
,
strokeColor
:
'
#007aff
'
,
display
:
true
,
},
loop
:
{
margin
:
2
,
gradient
:
true
,
}
}
},
},
addData
()
{
this
.
$refs
.
linechart
.
append
({
serial
:
0
,
data
:
[
Math
.
floor
(
Math
.
random
()
*
400
)
+
400
]
})
}
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/input/index.css
0 → 100644
浏览文件 @
1205a042
/* xxx.css */
.content
{
width
:
60%
;
flex-direction
:
column
;
align-items
:
center
;
}
.input
{
placeholder-color
:
gray
;
}
.button
{
background-color
:
gray
;
margin-top
:
20px
;
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/input/index.hml
0 → 100644
浏览文件 @
1205a042
<!-- xxx.hml -->
<div class="content">
<input id="input" class="input" type="text" value="" maxlength="20" enterkeytype="send"
headericon="/common/search.svg" placeholder="Please input text" onchange="change"
onenterkeyclick="enterkeyClick">
</input>
<input class="button" type="button" value="Submit" onclick="buttonClick"></input>
</div>
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/input/index.js
0 → 100644
浏览文件 @
1205a042
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
prompt
from
'
@system.prompt
'
export
default
{
change
(
e
){
prompt
.
showToast
({
message
:
"
value:
"
+
e
.
value
,
duration
:
3000
,
});
},
enterkeyClick
(
e
){
prompt
.
showToast
({
message
:
"
enterkey clicked
"
,
duration
:
3000
,
});
},
buttonClick
(
e
){
this
.
$element
(
"
input
"
).
showError
({
error
:
'
error text
'
});
},
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/slider/index.css
0 → 100644
浏览文件 @
1205a042
/* xxx.css */
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/slider/index.hml
0 → 100644
浏览文件 @
1205a042
<!-- xxx.hml -->
<div class="container">
<text>slider start value is {{startValue}}</text>
<text>slider current value is {{currentValue}}</text>
<text>slider end value is {{endValue}}</text>
<slider min="0" max="100" value="{{value}}" onchange="setvalue" ></slider>
</div>
\ No newline at end of file
ace/ace_standard/src/main/js/default/pages/slider/index.js
0 → 100644
浏览文件 @
1205a042
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
data
:
{
value
:
0
,
startValue
:
0
,
currentValue
:
0
,
endValue
:
0
,
},
setvalue
(
e
)
{
if
(
e
.
mode
==
"
start
"
)
{
this
.
value
=
e
.
value
;
this
.
startValue
=
e
.
value
;
}
else
if
(
e
.
mode
==
"
move
"
)
{
this
.
value
=
e
.
value
;
this
.
currentValue
=
e
.
value
;
}
else
if
(
e
.
mode
==
"
end
"
)
{
this
.
value
=
e
.
value
;
this
.
endValue
=
e
.
value
;
}
}
}
\ No newline at end of file
ace/ace_standard/src/main/js/default/test/List.test.js
浏览文件 @
1205a042
...
...
@@ -15,3 +15,4 @@
require
(
'
./basicabilityapi.test.js
'
)
require
(
'
./mediaquery.test.js
'
)
require
(
'
./commonComponentJsApi.test.js
'
)
ace/ace_standard/src/main/js/default/test/commonComponentJsApi.test.js
0 → 100644
浏览文件 @
1205a042
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
router
from
'
@system.router
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
describe
(
'
aceJsTest
'
,
function
()
{
async
function
sleep
(
time
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
()
},
time
)
}).
then
(()
=>
{
console
.
info
(
`sleep
${
time
}
over...`
)
})
}
/**
* run after testcase
*/
afterEach
(
async
function
()
{
console
.
info
(
'
[aceJsTest] after each called
'
)
router
.
clear
();
await
sleep
(
1000
)
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100
* @tc.name testButtonComponent
* @tc.desc ACE
*/
it
(
'
testButtonComponent
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testButtonComponent START
'
);
let
result
;
let
options
=
{
uri
:
'
pages/button/index
'
}
try
{
result
=
router
.
push
(
options
)
console
.
info
(
"
push button page success
"
+
JSON
.
stringify
(
result
));
}
catch
(
err
)
{
console
.
error
(
"
push button page error
"
+
JSON
.
stringify
(
result
));
}
await
sleep
(
1000
)
let
pages
=
router
.
getState
();
console
.
info
(
"
[router.button] getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/button/
"
).
assertEqual
(
pages
.
path
);
done
();
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0200
* @tc.name testChartComponent
* @tc.desc ACE
*/
it
(
'
testChartComponent
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testButtonComponent START
'
);
let
result
;
let
options
=
{
uri
:
'
pages/chart/index
'
}
try
{
result
=
router
.
push
(
options
)
console
.
info
(
"
push button page success
"
+
JSON
.
stringify
(
result
));
}
catch
(
err
)
{
console
.
error
(
"
push button page error
"
+
JSON
.
stringify
(
result
));
}
await
sleep
(
1000
)
let
pages
=
router
.
getState
();
console
.
info
(
"
[router.chart] getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/chart/
"
).
assertEqual
(
pages
.
path
);
done
();
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0300
* @tc.name testInputComponent
* @tc.desc ACE
*/
it
(
'
testInputComponent
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testButtonComponent START
'
);
let
result
;
let
options
=
{
uri
:
'
pages/input/index
'
}
try
{
result
=
router
.
push
(
options
)
console
.
info
(
"
push button page success
"
+
JSON
.
stringify
(
result
));
}
catch
(
err
)
{
console
.
error
(
"
push button page error
"
+
JSON
.
stringify
(
result
));
}
await
sleep
(
1000
)
let
pages
=
router
.
getState
();
console
.
info
(
"
[router.input] getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/input/
"
).
assertEqual
(
pages
.
path
);
done
();
});
/**
* @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0400
* @tc.name testSliderComponent
* @tc.desc ACE
*/
it
(
'
testSliderComponent
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testSliderComponent START
'
);
let
result
;
let
options
=
{
uri
:
'
pages/slider/index
'
}
try
{
result
=
router
.
push
(
options
)
console
.
info
(
"
push button page success
"
+
JSON
.
stringify
(
result
));
}
catch
(
err
)
{
console
.
error
(
"
push button page error
"
+
JSON
.
stringify
(
result
));
}
await
sleep
(
1000
)
let
pages
=
router
.
getState
();
console
.
info
(
"
[router.slider] getState
"
+
JSON
.
stringify
(
pages
));
expect
(
"
pages/slider/
"
).
assertEqual
(
pages
.
path
);
done
();
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录