Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
a5492d13
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5999
Star
91
Fork
163
代码
文件
提交
分支
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看板
提交
a5492d13
编写于
11月 09, 2024
作者:
taohebin@dcloud.io
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: dialog-page.uvue
上级
2c8ae5df
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
5 deletion
+56
-5
pages/API/dialog-page/dialog-1.uvue
pages/API/dialog-page/dialog-1.uvue
+1
-0
pages/API/dialog-page/dialog-page.test.js
pages/API/dialog-page/dialog-page.test.js
+31
-4
pages/API/dialog-page/dialog-page.uvue
pages/API/dialog-page/dialog-page.uvue
+24
-1
未找到文件。
pages/API/dialog-page/dialog-1.uvue
浏览文件 @
a5492d13
...
...
@@ -8,6 +8,7 @@
<button class="mt-10" id="dialog1-close-dialog" @click="closeDialog">closeDialog</button>
<button class="mt-10" id="dialog1-close-this-dialog" @click="closeThisDialog">closeThisDialog</button>
<button class="mt-10" id="dialog1-back" @click="back">back</button>
<input class="uni-common-mt" style="border-width: 1px;border-style: solid;" :focus="true" value="DialogPage中焦点测试"/>
</view>
</view>
</template>
...
...
pages/API/dialog-page/dialog-page.test.js
浏览文件 @
a5492d13
jest
.
setTimeout
(
20000
)
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
FIRST_PAGE_PATH
=
'
/pages/API/dialog-page/dialog-page
'
const
NEXT_PAGE_PATH
=
'
/pages/API/dialog-page/next-page
'
...
...
@@ -23,8 +24,8 @@ describe('dialog page', () => {
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
lifecycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifecycleNum
).
toBe
(
0
)
});
});
it
(
'
open dialog1
'
,
async
()
=>
{
await
page
.
callMethod
(
'
openDialog1
'
);
// 无法通过获取 dom 元素来判断是否打开了 dialogPage
...
...
@@ -280,7 +281,33 @@ describe('dialog page', () => {
lifecycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifecycleNum
).
toBe
(
2
)
})
it
(
'
input-hold-keyboard in dialog
'
,
async
()
=>
{
await
page
.
callMethod
(
'
jest_OpenDialog1
'
)
await
page
.
waitFor
(
2000
);
await
page
.
callMethod
(
'
jest_getTapPoint
'
)
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
if
(
isAndroid
){
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
console
.
log
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
);
}
else
{
await
program
.
tap
({
x
:
point_x
,
y
:
point_y
})
}
await
page
.
waitFor
(
1000
);
const
image
=
await
program
.
screenshot
({
deviceShot
:
true
,
area
:
{
x
:
0
,
y
:
200
,
}
})
expect
(
image
).
toSaveImageSnapshot
()
await
page
.
waitFor
(
2000
);
await
page
.
callMethod
(
'
jest_CloseDialog1
'
)
})
afterAll
(
async
()
=>
{
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
initLifeCycleNum
)
...
...
pages/API/dialog-page/dialog-page.uvue
浏览文件 @
a5492d13
...
...
@@ -15,7 +15,13 @@
setLifeCycleNum
} from '@/store/index.uts'
export default {
export default {
data() {
return {
jest_click_x: -1,
jest_click_y: -1
}
},
onLoad() {
console.log('dialogPage parent onLoad')
},
...
...
@@ -170,6 +176,23 @@
},
getLifeCycleNum(): number {
return state.lifeCycleNum
},
jest_OpenDialog1(){
uni.openDialogPage({
url: '/pages/API/dialog-page/dialog-1?name=dialog1'
})
},
jest_CloseDialog1(){
uni.closeDialogPage({})
},
jest_getTapPoint(){
const systemInfo = uni.getSystemInfoSync()
let ratio = 1
if (systemInfo.platform == 'android'){
ratio = systemInfo.devicePixelRatio
}
this.jest_click_x = systemInfo.screenWidth / 2 * ratio
this.jest_click_y = systemInfo.statusBarHeight * ratio + 10
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录