Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
55d552d9
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
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看板
提交
55d552d9
编写于
8月 17, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: navigator
上级
06825729
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
232 addition
and
195 deletion
+232
-195
pages/API/navigator/navigator.test.js
pages/API/navigator/navigator.test.js
+48
-1
pages/API/navigator/navigator.uvue
pages/API/navigator/navigator.uvue
+0
-10
pages/tabBar/API.uvue
pages/tabBar/API.uvue
+184
-184
未找到文件。
pages/API/navigator/navigator.test.js
浏览文件 @
55d552d9
jest
.
setTimeout
(
4
0000
)
jest
.
setTimeout
(
8
0000
)
const
CURRENT_PAGE_PATH
=
'
/pages/API/navigator/navigator
'
const
CHILD1_PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-1
'
const
CHILD2_PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-2
'
...
...
@@ -140,6 +140,7 @@ describe('navigator', () => {
})
it
(
'
switchTab
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
CURRENT_PAGE_PATH
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
switchTab
'
)
await
page
.
waitFor
(
500
)
...
...
@@ -148,4 +149,50 @@ describe('navigator', () => {
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
})
it
(
'
20 times navigateTo
'
,
async
()
=>
{
const
originPageStack
=
await
program
.
pageStack
()
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD1_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD1_PAGE_PATH
.
substring
(
1
))
page
=
await
program
.
navigateTo
(
CHILD2_PAGE_PATH
)
expect
(
page
.
path
).
toBe
(
CHILD2_PAGE_PATH
.
substring
(
1
))
const
newPageStack
=
await
program
.
pageStack
()
expect
(
newPageStack
.
length
-
originPageStack
.
length
).
toBe
(
20
)
})
})
pages/API/navigator/navigator.uvue
浏览文件 @
55d552d9
...
...
@@ -39,9 +39,6 @@
<button @tap="reLaunch" class="uni-btn">
关闭所有页面,打开首页
</button>
<button @tap="customAnimation" class="uni-btn">
使用自定义动画打开页面
</button>
<button @tap="navigateToErrorPage" class="uni-btn">
打开不存在的页面
</button>
...
...
@@ -346,13 +343,6 @@ export default {
},
})
},
customAnimation() {
uni.navigateTo({
url: '/pages/API/navigator/new-page/new-page-1?data=自定义动画打开页面',
animationType: 'slide-in-bottom',
animationDuration: 200,
})
},
// 自动化测试
getLifeCycleNum(): number {
return state.lifeCycleNum
...
...
pages/tabBar/API.uvue
浏览文件 @
55d552d9
...
...
@@ -144,20 +144,20 @@ export default {
open: false,
pages: [
/* {
name: "创建动画",
url: "animation",
enable: false
},
{
name: "创建绘画",
url: "canvas",
enable: false
},
{
name: "节点布局交互状态",
url: "intersection-observer",
enable: false
}, */
name: "创建动画",
url: "animation",
enable: false
},
{
name: "创建绘画",
url: "canvas",
enable: false
},
{
name: "节点布局交互状态",
url: "intersection-observer",
enable: false
}, */
{
name: '节点信息',
url: 'nodes-info',
...
...
@@ -222,57 +222,57 @@ export default {
url: 'get-battery-info',
},
/* {
name: "打电话",
url: "make-phone-call",
},
{
name: "震动",
url: "vibrate",
},
{
name: "添加手机联系人",
url: "add-phone-contact",
},
{
name: "扫码",
url: "scan-code",
},
{
name: "剪贴板",
url: "clipboard",
},
{
name: "屏幕亮度",
url: "brightness",
},
{
name: "蓝牙",
url: "bluetooth",
},
{
name: "生物认证",
url: "soter",
},
{
name: "iBeacon",
url: "ibeacon",
},
{
name: "监听加速度传感器",
url: "on-accelerometer-change",
},
{
name: "监听罗盘数据",
url: "on-compass-change",
},
{
name: "监听距离传感器",
url: "/platforms/app-plus/proximity/proximity",
},
{
name: "监听方向传感器",
url: "/platforms/app-plus/orientation/orientation",
}, */
name: "打电话",
url: "make-phone-call",
},
{
name: "震动",
url: "vibrate",
},
{
name: "添加手机联系人",
url: "add-phone-contact",
},
{
name: "扫码",
url: "scan-code",
},
{
name: "剪贴板",
url: "clipboard",
},
{
name: "屏幕亮度",
url: "brightness",
},
{
name: "蓝牙",
url: "bluetooth",
},
{
name: "生物认证",
url: "soter",
},
{
name: "iBeacon",
url: "ibeacon",
},
{
name: "监听加速度传感器",
url: "on-accelerometer-change",
},
{
name: "监听罗盘数据",
url: "on-compass-change",
},
{
name: "监听距离传感器",
url: "/platforms/app-plus/proximity/proximity",
},
{
name: "监听方向传感器",
url: "/platforms/app-plus/orientation/orientation",
}, */
] as Page[],
},
{
...
...
@@ -319,34 +319,34 @@ export default {
url: 'preview-image',
},
/* {
name: "图片选择和拍照",
url: "image",
enable: false
},{
name: "音频",
url: "inner-audio",
},
{
name: "录音",
url: "voice",
},
{
name: "背景音频",
url: "background-audio",
},
{
name: "视频选择和拍照",
url: "video",
enable: false
},
{
name: "文件",
url: "file",
},
{
name: "保存媒体到本地",
url: "save-media",
}, */
name: "图片选择和拍照",
url: "image",
enable: false
},{
name: "音频",
url: "inner-audio",
},
{
name: "录音",
url: "voice",
},
{
name: "背景音频",
url: "background-audio",
},
{
name: "视频选择和拍照",
url: "video",
enable: false
},
{
name: "文件",
url: "file",
},
{
name: "保存媒体到本地",
url: "save-media",
}, */
] as Page[],
},
{
...
...
@@ -358,22 +358,22 @@ export default {
name: '获取当前位置',
url: 'get-location',
},
/*
{
name: "使用地图查看位置",
url: "open-location",
},
{
name: "使用地图选择位置",
url: "choose-location",
},
{
name: "地图控制",
url: "map",
},
{
name: "地图搜索",
url: "map-search",
}, */
/* {
name: "使用地图查看位置",
url: "open-location",
},
{
name: "使用地图选择位置",
url: "choose-location",
},
{
name: "地图控制",
url: "map",
},
{
name: "地图搜索",
url: "map-search",
}, */
] as Page[],
},
{
...
...
@@ -387,81 +387,81 @@ export default {
},
] as Page[],
},
/*
{
id: "rewarded-video-ad",
url: "rewarded-video-ad",
name: "激励视频广告",
open: false,
enable: false,
pages: [] as Page[]
},
{
id: "full-screen-video-ad",
url: "full-screen-video-ad",
name: "全屏视频广告",
open: false,
enable: false,
pages: [] as Page[]
},
{
id: "login",
name: "登录",
open: false,
pages: [
{
name: "登录",
url: "login",
},
{
name: "获取用户信息",
url: "get-user-info",
},
] as Page[],
},
{
id: "share",
name: "分享",
open: false,
pages: [
{
name: "分享",
url: "share",
},
] as Page[],
},
{
id: "payment",
name: "支付",
open: false,
pages: [
{
name: "发起支付",
url: "request-payment",
},
] as Page[],
},
{
id: "speech",
name: "语音",
open: false,
pages: [
{
name: "语音识别",
url: "/platforms/app-plus/speech/speech",
},
] as Page[],
},
{
id: "push",
name: "推送",
open: false,
pages: [
{
name: "推送",
url: "/platforms/app-plus/push/push",
},
] as Page[],
}, */
/* {
id: "rewarded-video-ad",
url: "rewarded-video-ad",
name: "激励视频广告",
open: false,
enable: false,
pages: [] as Page[]
},
{
id: "full-screen-video-ad",
url: "full-screen-video-ad",
name: "全屏视频广告",
open: false,
enable: false,
pages: [] as Page[]
},
{
id: "login",
name: "登录",
open: false,
pages: [
{
name: "登录",
url: "login",
},
{
name: "获取用户信息",
url: "get-user-info",
},
] as Page[],
},
{
id: "share",
name: "分享",
open: false,
pages: [
{
name: "分享",
url: "share",
},
] as Page[],
},
{
id: "payment",
name: "支付",
open: false,
pages: [
{
name: "发起支付",
url: "request-payment",
},
] as Page[],
},
{
id: "speech",
name: "语音",
open: false,
pages: [
{
name: "语音识别",
url: "/platforms/app-plus/speech/speech",
},
] as Page[],
},
{
id: "push",
name: "推送",
open: false,
pages: [
{
name: "推送",
url: "/platforms/app-plus/push/push",
},
] as Page[],
}, */
{
id: 'exit',
name: '退出',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录