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
CURRENT_PAGE_PATH
=
'
/pages/API/navigator/navigator
'
const
CHILD1_PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-1
'
const
CHILD1_PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-1
'
const
CHILD2_PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-2
'
const
CHILD2_PAGE_PATH
=
'
/pages/API/navigator/new-page/new-page-2
'
...
@@ -140,6 +140,7 @@ describe('navigator', () => {
...
@@ -140,6 +140,7 @@ describe('navigator', () => {
})
})
it
(
'
switchTab
'
,
async
()
=>
{
it
(
'
switchTab
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
CURRENT_PAGE_PATH
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
0
)
await
page
.
callMethod
(
'
switchTab
'
)
await
page
.
callMethod
(
'
switchTab
'
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
500
)
...
@@ -148,4 +149,50 @@ describe('navigator', () => {
...
@@ -148,4 +149,50 @@ describe('navigator', () => {
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
2
)
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 @@
...
@@ -39,9 +39,6 @@
<button @tap="reLaunch" class="uni-btn">
<button @tap="reLaunch" class="uni-btn">
关闭所有页面,打开首页
关闭所有页面,打开首页
</button>
</button>
<button @tap="customAnimation" class="uni-btn">
使用自定义动画打开页面
</button>
<button @tap="navigateToErrorPage" class="uni-btn">
<button @tap="navigateToErrorPage" class="uni-btn">
打开不存在的页面
打开不存在的页面
</button>
</button>
...
@@ -346,13 +343,6 @@ export default {
...
@@ -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 {
getLifeCycleNum(): number {
return state.lifeCycleNum
return state.lifeCycleNum
...
...
pages/tabBar/API.uvue
浏览文件 @
55d552d9
...
@@ -144,20 +144,20 @@ export default {
...
@@ -144,20 +144,20 @@ export default {
open: false,
open: false,
pages: [
pages: [
/* {
/* {
name: "创建动画",
name: "创建动画",
url: "animation",
url: "animation",
enable: false
enable: false
},
},
{
{
name: "创建绘画",
name: "创建绘画",
url: "canvas",
url: "canvas",
enable: false
enable: false
},
},
{
{
name: "节点布局交互状态",
name: "节点布局交互状态",
url: "intersection-observer",
url: "intersection-observer",
enable: false
enable: false
}, */
}, */
{
{
name: '节点信息',
name: '节点信息',
url: 'nodes-info',
url: 'nodes-info',
...
@@ -222,57 +222,57 @@ export default {
...
@@ -222,57 +222,57 @@ export default {
url: 'get-battery-info',
url: 'get-battery-info',
},
},
/* {
/* {
name: "打电话",
name: "打电话",
url: "make-phone-call",
url: "make-phone-call",
},
},
{
{
name: "震动",
name: "震动",
url: "vibrate",
url: "vibrate",
},
},
{
{
name: "添加手机联系人",
name: "添加手机联系人",
url: "add-phone-contact",
url: "add-phone-contact",
},
},
{
{
name: "扫码",
name: "扫码",
url: "scan-code",
url: "scan-code",
},
},
{
{
name: "剪贴板",
name: "剪贴板",
url: "clipboard",
url: "clipboard",
},
},
{
{
name: "屏幕亮度",
name: "屏幕亮度",
url: "brightness",
url: "brightness",
},
},
{
{
name: "蓝牙",
name: "蓝牙",
url: "bluetooth",
url: "bluetooth",
},
},
{
{
name: "生物认证",
name: "生物认证",
url: "soter",
url: "soter",
},
},
{
{
name: "iBeacon",
name: "iBeacon",
url: "ibeacon",
url: "ibeacon",
},
},
{
{
name: "监听加速度传感器",
name: "监听加速度传感器",
url: "on-accelerometer-change",
url: "on-accelerometer-change",
},
},
{
{
name: "监听罗盘数据",
name: "监听罗盘数据",
url: "on-compass-change",
url: "on-compass-change",
},
},
{
{
name: "监听距离传感器",
name: "监听距离传感器",
url: "/platforms/app-plus/proximity/proximity",
url: "/platforms/app-plus/proximity/proximity",
},
},
{
{
name: "监听方向传感器",
name: "监听方向传感器",
url: "/platforms/app-plus/orientation/orientation",
url: "/platforms/app-plus/orientation/orientation",
}, */
}, */
] as Page[],
] as Page[],
},
},
{
{
...
@@ -319,34 +319,34 @@ export default {
...
@@ -319,34 +319,34 @@ export default {
url: 'preview-image',
url: 'preview-image',
},
},
/* {
/* {
name: "图片选择和拍照",
name: "图片选择和拍照",
url: "image",
url: "image",
enable: false
enable: false
},{
},{
name: "音频",
name: "音频",
url: "inner-audio",
url: "inner-audio",
},
},
{
{
name: "录音",
name: "录音",
url: "voice",
url: "voice",
},
},
{
{
name: "背景音频",
name: "背景音频",
url: "background-audio",
url: "background-audio",
},
},
{
{
name: "视频选择和拍照",
name: "视频选择和拍照",
url: "video",
url: "video",
enable: false
enable: false
},
},
{
{
name: "文件",
name: "文件",
url: "file",
url: "file",
},
},
{
{
name: "保存媒体到本地",
name: "保存媒体到本地",
url: "save-media",
url: "save-media",
}, */
}, */
] as Page[],
] as Page[],
},
},
{
{
...
@@ -358,22 +358,22 @@ export default {
...
@@ -358,22 +358,22 @@ export default {
name: '获取当前位置',
name: '获取当前位置',
url: 'get-location',
url: 'get-location',
},
},
/*
{
/* {
name: "使用地图查看位置",
name: "使用地图查看位置",
url: "open-location",
url: "open-location",
},
},
{
{
name: "使用地图选择位置",
name: "使用地图选择位置",
url: "choose-location",
url: "choose-location",
},
},
{
{
name: "地图控制",
name: "地图控制",
url: "map",
url: "map",
},
},
{
{
name: "地图搜索",
name: "地图搜索",
url: "map-search",
url: "map-search",
}, */
}, */
] as Page[],
] as Page[],
},
},
{
{
...
@@ -387,81 +387,81 @@ export default {
...
@@ -387,81 +387,81 @@ export default {
},
},
] as Page[],
] as Page[],
},
},
/*
{
/* {
id: "rewarded-video-ad",
id: "rewarded-video-ad",
url: "rewarded-video-ad",
url: "rewarded-video-ad",
name: "激励视频广告",
name: "激励视频广告",
open: false,
open: false,
enable: false,
enable: false,
pages: [] as Page[]
pages: [] as Page[]
},
},
{
{
id: "full-screen-video-ad",
id: "full-screen-video-ad",
url: "full-screen-video-ad",
url: "full-screen-video-ad",
name: "全屏视频广告",
name: "全屏视频广告",
open: false,
open: false,
enable: false,
enable: false,
pages: [] as Page[]
pages: [] as Page[]
},
},
{
{
id: "login",
id: "login",
name: "登录",
name: "登录",
open: false,
open: false,
pages: [
pages: [
{
{
name: "登录",
name: "登录",
url: "login",
url: "login",
},
},
{
{
name: "获取用户信息",
name: "获取用户信息",
url: "get-user-info",
url: "get-user-info",
},
},
] as Page[],
] as Page[],
},
},
{
{
id: "share",
id: "share",
name: "分享",
name: "分享",
open: false,
open: false,
pages: [
pages: [
{
{
name: "分享",
name: "分享",
url: "share",
url: "share",
},
},
] as Page[],
] as Page[],
},
},
{
{
id: "payment",
id: "payment",
name: "支付",
name: "支付",
open: false,
open: false,
pages: [
pages: [
{
{
name: "发起支付",
name: "发起支付",
url: "request-payment",
url: "request-payment",
},
},
] as Page[],
] as Page[],
},
},
{
{
id: "speech",
id: "speech",
name: "语音",
name: "语音",
open: false,
open: false,
pages: [
pages: [
{
{
name: "语音识别",
name: "语音识别",
url: "/platforms/app-plus/speech/speech",
url: "/platforms/app-plus/speech/speech",
},
},
] as Page[],
] as Page[],
},
},
{
{
id: "push",
id: "push",
name: "推送",
name: "推送",
open: false,
open: false,
pages: [
pages: [
{
{
name: "推送",
name: "推送",
url: "/platforms/app-plus/push/push",
url: "/platforms/app-plus/push/push",
},
},
] as Page[],
] as Page[],
}, */
}, */
{
{
id: 'exit',
id: 'exit',
name: '退出',
name: '退出',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录