Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
7f361455
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6007
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7f361455
编写于
11月 01, 2024
作者:
辛宝Otto
🥊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(picker-view): 初始化展示日期为静态值,避免每次截图不同、日期相同导致不滚动
上级
d51aec04
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
31 addition
and
22 deletion
+31
-22
pages/component/picker-view/picker-view.test.js
pages/component/picker-view/picker-view.test.js
+23
-14
pages/component/picker-view/picker-view.uvue
pages/component/picker-view/picker-view.uvue
+8
-8
未找到文件。
pages/component/picker-view/picker-view.test.js
浏览文件 @
7f361455
const
PAGE_PATH
=
'
/pages/component/picker-view/picker-view
'
let
page
,
pickerViewEl
;
let
page
,
pickerViewEl
;
describe
(
'
PickerView.uvue
'
,
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -14,16 +13,22 @@ describe('PickerView.uvue', () => {
})
async
function
toScreenshot
(
imgName
)
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
({
customSnapshotIdentifier
()
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
({
customSnapshotIdentifier
()
{
return
imgName
}})
}
})
await
page
.
waitFor
(
500
);
}
it
(
'
value
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setValue
'
)
await
page
.
waitFor
(
1000
)
const
newValue1
=
await
pickerViewEl
.
property
(
'
value
'
)
// TODO
expect
(
newValue1
.
toString
()).
toEqual
(
'
0,0,0
'
)
...
...
@@ -58,27 +63,31 @@ describe('PickerView.uvue', () => {
await
toScreenshot
(
'
picker-view-indicator-style
'
)
})
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// indicator-class、mask-style、mask-class 仅web支持
it
(
'
indicator-class
'
,
async
()
=>
{
await
page
.
setData
({
indicatorStyle
:
""
,
//清空indicatorStyle
indicatorClass
:
"
indicator-test
"
,
//设置indicatorClass为indicator-test
indicatorStyle
:
""
,
//清空indicatorStyle
indicatorClass
:
"
indicator-test
"
,
//设置indicatorClass为indicator-test
})
expect
(
await
pickerViewEl
.
attribute
(
'
indicatorClass
'
)).
toBe
(
"
indicator-test
"
)
await
toScreenshot
(
'
picker-view-web-indicator-class
'
)
await
page
.
setData
({
indicatorClass
:
""
,
//清空indicatorClass
indicatorClass
:
""
,
//清空indicatorClass
})
})
it
(
'
mask-style
'
,
async
()
=>
{
const
maskStyle
=
"
background-image: linear-gradient(to bottom, #d8e5ff, rgba(216, 229, 255, 0));
"
await
page
.
setData
({
maskStyle
})
await
page
.
setData
({
maskStyle
})
expect
(
await
pickerViewEl
.
attribute
(
'
maskStyle
'
)).
toBe
(
maskStyle
)
await
toScreenshot
(
'
picker-view-web-mask-style
'
)
})
it
(
'
mask-class
'
,
async
()
=>
{
await
page
.
setData
({
maskClass
:
"
mask-test
"
})
await
page
.
setData
({
maskClass
:
"
mask-test
"
})
expect
(
await
pickerViewEl
.
attribute
(
'
maskClass
'
)).
toBe
(
"
mask-test
"
)
await
toScreenshot
(
'
picker-view-web-mask-class
'
)
})
...
...
@@ -121,7 +130,7 @@ describe('PickerView.uvue', () => {
await
page
.
callMethod
(
'
setValue
'
)
await
page
.
waitFor
(
1500
)
const
eventCallbackNum
=
await
page
.
callMethod
(
'
getEventCallbackNum
'
)
//
3 times 3*3
//
年月日滚动三次,测试 e.tagName +1 和 e.type+2,正常为9
expect
(
eventCallbackNum
).
toBe
(
9
)
})
}
...
...
pages/component/picker-view/picker-view.uvue
浏览文件 @
7f361455
...
...
@@ -27,13 +27,13 @@
import { state, setEventCallbackNum } from '@/store/index.uts'
export default {
data() {
const date = new Date(
)
// 20180112 HBuilderX内测开始 :
)
const _years : number[] = []
const _year =
date.getFullYear()
const _year =
2018
const _months : number[] = []
const _month : number =
date.getMonth() +
1
const _month : number = 1
const _days : number[] = []
const _day =
date.getDate()
const _day =
12
for (let i = 2000; i <= _year; i++) {
_years.push(i)
}
...
...
@@ -72,8 +72,8 @@
setEventCallbackNum(num)
},
bindChange(e : UniPickerViewChangeEvent) {
// 自动化测试
console.log(e.target?.tagName, e.type);
// 自动化测试
触发事件元素、type 类型
//
console.log(e.target?.tagName, e.type);
if ((e.target?.tagName ?? '').includes('PICKER-VIEW')) {
this.setEventCallbackNum(state.eventCallbackNum + 1)
}
...
...
@@ -87,7 +87,7 @@
this.day = this.days[val[2]]
},
setValue() {
this.value = [0,
0,
0] as number[]
this.value = [0,
1, 3
0] as number[]
},
setValue1() {
this.value = [10, 10, 10] as number[]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录