Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
8635bc49
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5992
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看板
提交
8635bc49
编写于
12月 18, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 兼容 web 端
上级
3e119088
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
257 addition
and
226 deletion
+257
-226
App.uvue
App.uvue
+2
-2
pages/API/get-app/get-app.test.js
pages/API/get-app/get-app.test.js
+9
-9
pages/API/get-app/get-app.uvue
pages/API/get-app/get-app.uvue
+17
-17
pages/API/get-current-pages/get-current-pages.test.js
pages/API/get-current-pages/get-current-pages.test.js
+11
-0
pages/API/get-launch-options-sync/get-launch-options-sync.uvue
.../API/get-launch-options-sync/get-launch-options-sync.uvue
+1
-1
pages/API/load-font-face/load-font-face.uvue
pages/API/load-font-face/load-font-face.uvue
+6
-6
pages/API/navigator/new-page/onLoad.test.js
pages/API/navigator/new-page/onLoad.test.js
+11
-9
pages/API/navigator/new-page/onLoad.uvue
pages/API/navigator/new-page/onLoad.uvue
+124
-111
pages/component/general-attribute/general-attribute.uvue
pages/component/general-attribute/general-attribute.uvue
+5
-0
pages/component/general-event/general-event.test.js
pages/component/general-event/general-event.test.js
+64
-70
pages/tabBar/API.uvue
pages/tabBar/API.uvue
+7
-1
未找到文件。
App.uvue
浏览文件 @
8635bc49
...
...
@@ -14,8 +14,8 @@
},
null: null as string | null,
arr: [] as number[],
s
et: new Set<string>(),
map: new Map<string, any>(),
myS
et: new Set<string>(),
m
yM
ap: new Map<string, any>(),
func: (): string => {
return 'globalData func'
}
...
...
pages/API/get-app/get-app.test.js
浏览文件 @
8635bc49
...
...
@@ -8,7 +8,7 @@ describe('getApp', () => {
})
it
(
'
globalData
'
,
async
()
=>
{
await
page
.
callMethod
(
'
getGlobalData
'
)
let
data
=
await
page
.
data
()
let
data
=
await
page
.
data
()
expect
(
data
.
originGlobalData
.
str
).
toBe
(
'
default globalData str
'
)
expect
(
data
.
originGlobalData
.
num
).
toBe
(
0
)
expect
(
data
.
originGlobalData
.
bool
).
toBe
(
false
)
...
...
@@ -19,11 +19,11 @@ describe('getApp', () => {
})
expect
(
data
.
originGlobalData
.
arr
).
toEqual
([])
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
data
.
originGlobalData
.
s
et
).
toEqual
([])
expect
(
data
.
originGlobalData
.
myS
et
).
toEqual
([])
}
else
{
expect
(
data
.
originGlobalData
.
s
et
).
toEqual
({})
expect
(
data
.
originGlobalData
.
myS
et
).
toEqual
({})
}
expect
(
data
.
originGlobalData
.
map
).
toEqual
({})
expect
(
data
.
originGlobalData
.
m
yM
ap
).
toEqual
({})
expect
(
data
.
originGlobalDataFuncRes
).
toBe
(
'
globalData func
'
)
await
page
.
callMethod
(
'
setGlobalData
'
)
data
=
await
page
.
data
()
...
...
@@ -37,18 +37,18 @@ describe('getApp', () => {
})
expect
(
data
.
newGlobalData
.
arr
).
toEqual
([
1
,
2
,
3
])
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
data
.
newGlobalData
.
s
et
).
toEqual
([
'
a
'
,
'
b
'
,
'
c
'
])
expect
(
data
.
newGlobalData
.
myS
et
).
toEqual
([
'
a
'
,
'
b
'
,
'
c
'
])
}
else
{
expect
(
data
.
originGlobalData
.
s
et
).
toEqual
({})
expect
(
data
.
originGlobalData
.
myS
et
).
toEqual
({})
}
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
data
.
newGlobalData
.
map
).
toEqual
({
expect
(
data
.
newGlobalData
.
m
yM
ap
).
toEqual
({
'
a
'
:
1
,
'
b
'
:
2
,
'
c
'
:
3
})
}
else
{
expect
(
data
.
originGlobalData
.
map
).
toEqual
({})
expect
(
data
.
originGlobalData
.
m
yM
ap
).
toEqual
({})
}
expect
(
data
.
newGlobalDataFuncRes
).
toBe
(
'
new globalData func
'
)
})
...
...
@@ -59,4 +59,4 @@ describe('getApp', () => {
expect
(
newLifeCycleNum
-
oldLifeCycleNum
).
toBe
(
100
)
await
page
.
callMethod
(
'
setLifeCycleNum
'
,
oldLifeCycleNum
)
})
})
\ No newline at end of file
})
pages/API/get-app/get-app.uvue
浏览文件 @
8635bc49
...
...
@@ -14,11 +14,11 @@
<text class="uni-common-mt">globalData object: {{ originGlobalData.obj }}</text>
<text class="uni-common-mt">globalData null: {{ originGlobalData.null }}</text>
<text class="uni-common-mt">globalData array: {{ originGlobalData.arr }}</text>
<text class="uni-common-mt">globalData Set: {{ originGlobalData.
s
et }}</text>
<text class="uni-common-mt">globalData Map: {{ originGlobalData.map }}</text>
<text class="uni-common-mt">globalData Set: {{ originGlobalData.
myS
et }}</text>
<text class="uni-common-mt">globalData Map: {{ originGlobalData.m
yM
ap }}</text>
<text class="uni-common-mt">globalData func 返回值: {{ originGlobalDataFuncRes }}</text>
</template>
<button @click="setGlobalData" class="uni-common-mt">
s
et globalData</button>
<button @click="setGlobalData" class="uni-common-mt">
myS
et globalData</button>
<template v-if="newGlobalData.bool">
<text class="uni-common-mt bold">更新后的 globalData:</text>
<text class="uni-common-mt">globalData string: {{ newGlobalData.str }}</text>
...
...
@@ -27,8 +27,8 @@
<text class="uni-common-mt">globalData object: {{ newGlobalData.obj }}</text>
<text class="uni-common-mt">globalData null: {{ newGlobalData.null }}</text>
<text class="uni-common-mt">globalData array: {{ newGlobalData.arr }}</text>
<text class="uni-common-mt">globalData Set: {{ newGlobalData.
s
et }}</text>
<text class="uni-common-mt">globalData Map: {{ newGlobalData.map }}</text>
<text class="uni-common-mt">globalData Set: {{ newGlobalData.
myS
et }}</text>
<text class="uni-common-mt">globalData Map: {{ newGlobalData.m
yM
ap }}</text>
<text class="uni-common-mt">globalData func 返回值: {{ newGlobalDataFuncRes }}</text>
</template>
<view class="uni-common-mt hr"></view>
...
...
@@ -53,8 +53,8 @@
obj : UTSJSONObject,
null : string | null,
arr : number[],
s
et : Set<string>,
map : Map<string, any>,
myS
et : Set<string>,
m
yM
ap : Map<string, any>,
func : () => string
}
import { state, setLifeCycleNum } from '@/store/index.uts'
...
...
@@ -73,8 +73,8 @@
} as UTSJSONObject,
null: null,
arr: [] as number[],
s
et: new Set<string>(),
map: new Map<string, any>(),
myS
et: new Set<string>(),
m
yM
ap: new Map<string, any>(),
func: () : string => ''
} as MyGlobalData,
originGlobalDataFuncRes: '',
...
...
@@ -89,8 +89,8 @@
} as UTSJSONObject,
null: null,
arr: [] as number[],
s
et: new Set<string>(),
map: new Map<string, any>(),
myS
et: new Set<string>(),
m
yM
ap: new Map<string, any>(),
func: () : string => ''
} as MyGlobalData,
newGlobalDataFuncRes: '',
...
...
@@ -109,8 +109,8 @@
this.originGlobalData.obj = app.globalData.obj
this.originGlobalData.null = app.globalData.null
this.originGlobalData.arr = app.globalData.arr
this.originGlobalData.
set = app.globalData.s
et
this.originGlobalData.m
ap = app.globalData.m
ap
this.originGlobalData.
mySet = app.globalData.myS
et
this.originGlobalData.m
yMap = app.globalData.myM
ap
this.originGlobalData.func = app.globalData.func
this.originGlobalDataFuncRes = this.originGlobalData.func()
},
...
...
@@ -127,8 +127,8 @@
}
app.globalData.null = 'not null'
app.globalData.arr = [1, 2, 3]
app.globalData.
s
et = new Set(['a', 'b', 'c'])
app.globalData.map = new Map([
app.globalData.
myS
et = new Set(['a', 'b', 'c'])
app.globalData.m
yM
ap = new Map([
['a', 1],
['b', 2],
['c', 3]
...
...
@@ -143,8 +143,8 @@
this.newGlobalData.obj = app.globalData.obj
this.newGlobalData.null = app.globalData.null
this.newGlobalData.arr = app.globalData.arr
this.newGlobalData.
set = app.globalData.s
et
this.newGlobalData.m
ap = app.globalData.m
ap
this.newGlobalData.
mySet = app.globalData.myS
et
this.newGlobalData.m
yMap = app.globalData.myM
ap
this.newGlobalData.func = app.globalData.func
this.newGlobalDataFuncRes = this.newGlobalData.func()
},
...
...
pages/API/get-current-pages/get-current-pages.test.js
浏览文件 @
8635bc49
...
...
@@ -4,6 +4,17 @@ const PAGE_PATH = '/pages/API/get-current-pages/get-current-pages'
describe
(
'
getCurrentPages
'
,
()
=>
{
let
page
it
(
'
getCurrentPages
'
,
async
()
=>
{
// web 端等待应用首页加载完成
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
const
waitTime
=
process
.
env
.
uniTestPlatformInfo
.
includes
(
'
safari
'
)
?
5000
:
1000
await
new
Promise
((
resolve
)
=>
{
setTimeout
(()
=>
{
resolve
()
},
waitTime
)
})
}
page
=
await
program
.
switchTab
(
HOME_PAGE_PATH
)
await
page
.
waitFor
(
1000
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
...
...
pages/API/get-launch-options-sync/get-launch-options-sync.uvue
浏览文件 @
8635bc49
...
...
@@ -24,7 +24,7 @@ export default {
getLaunchOptionsSync() {
const launchOptions = uni.getLaunchOptionsSync()
this.launchOptionsPath = launchOptions.path
if (launchOptions.path == this.homePagePath) {
if (launchOptions.path ==
= this.homePagePath || `/${launchOptions.path}` ===
this.homePagePath) {
this.checked = true
}
},
...
...
pages/API/load-font-face/load-font-face.uvue
浏览文件 @
8635bc49
...
...
@@ -37,7 +37,7 @@
uni.loadFontFace({
global: true,
family: 'UniFontFamily',
source:
'/static/font/uni.ttf'
,
source:
"url('/static/font/uni.ttf')"
,
success() {
console.log('global loadFontFace uni.ttf success')
},
...
...
@@ -48,7 +48,7 @@
uni.loadFontFace({
family: 'AlimamaDaoLiTiTTF',
source:
'https://native-res.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf'
,
"url('https://native-res.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf')"
,
success() {
console.log('loadFontFace Remote AlimamaDaoLiTi.ttf success')
},
...
...
@@ -58,7 +58,7 @@
})
uni.loadFontFace({
family: 'AlimamaDaoLiTiOTF',
source:
'/static/font/AlimamaDaoLiTi.otf'
,
source:
"url('/static/font/AlimamaDaoLiTi.otf')"
,
success() {
console.log('loadFontFace AlimamaDaoLiTi.otf success')
},
...
...
@@ -68,7 +68,7 @@
})
uni.loadFontFace({
family: 'AlimamaDaoLiTiWOFF',
source:
'/static/font/AlimamaDaoLiTi.woff'
,
source:
"url('/static/font/AlimamaDaoLiTi.woff')"
,
success() {
console.log('loadFontFace AlimamaDaoLiTi.woff success')
},
...
...
@@ -78,7 +78,7 @@
})
uni.loadFontFace({
family: 'AlimamaDaoLiTiWOFF2',
source:
'/static/font/AlimamaDaoLiTi.woff2'
,
source:
"url('/static/font/AlimamaDaoLiTi.woff2')"
,
success() {
console.log('loadFontFace AlimamaDaoLiTi.woff2 success')
},
...
...
@@ -105,4 +105,4 @@
.line-height-40 {
line-height: 40px;
}
</style>
\ No newline at end of file
</style>
pages/API/navigator/new-page/onLoad.test.js
浏览文件 @
8635bc49
...
...
@@ -9,7 +9,7 @@ describe("onLoad", () => {
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
adjustData
"
);
await
page
.
waitFor
(
100
);
await
page
.
waitFor
(
100
0
);
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
});
...
...
@@ -17,17 +17,19 @@ describe("onLoad", () => {
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateTo
"
);
await
page
.
waitFor
(
100
);
await
page
.
waitFor
(
100
0
);
page
=
await
program
.
currentPage
();
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
});
it
(
"
navigateBack
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateBack
"
);
page
=
await
program
.
currentPage
();
await
page
.
waitFor
(
'
view
'
);
expect
(
page
.
path
).
toBe
(
INTERMEDIATE_PAGE_PATH
.
substring
(
1
));
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateBack
"
);
await
page
.
waitFor
(
'
view
'
);
page
=
await
program
.
currentPage
();
expect
(
page
.
path
).
toBe
(
INTERMEDIATE_PAGE_PATH
.
substring
(
1
));
}
});
it
(
"
redirectTo
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
...
...
@@ -126,4 +128,4 @@ describe("onLoad", () => {
failureThresholdType
:
"
percent
"
,
});
});
});
});
pages/API/navigator/new-page/onLoad.uvue
浏览文件 @
8635bc49
<template>
<view class="uni-padding-wrap">
<page-head title="onLoad 生命周期调用 uni api 测试" />
<text v-if="isTrue">v-if with true</text>
<text v-if="isFalse">v-if with false</text>
<text v-show="isTrue">v-show with true</text>
<text v-show="isFalse">v-show with false</text>
<text>msg: {{ msg }}</text>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
isTrue: false,
isFalse: true,
msg: 'default msg'
}
},
onLoad(options: OnLoadOptions) {
const type = options.get('type')
switch (type) {
case 'adjustData':
this.adjustData()
break;
case 'navigateTo':
this.navigateTo()
break;
case 'navigateBack':
this.navigateBack()
break;
case 'redirectTo':
this.redirectTo()
break;
case 'reLaunch':
this.reLaunch()
break;
case 'switchTab':
this.switchTab()
break;
case 'showToast':
this.showToast()
break;
case 'showLoading':
this.showLoading()
break;
case 'showModal':
this.showModal()
break;
case 'showActionSheet':
this.showActionSheet()
break;
}
},
methods: {
adjustData(){
this.isTrue = true
this.isFalse = false
this.msg = 'new msg'
},
navigateTo(){
uni.navigateTo({
url: '/pages/API/navigator/new-page/new-page-3'
})
},
navigateBack(){
uni.navigateBack()
},
redirectTo(){
uni.redirectTo({
url: '/pages/API/navigator/new-page/new-page-3'
})
},
reLaunch(){
uni.reLaunch({
url: '/pages/API/navigator/new-page/new-page-3'
})
},
switchTab(){
uni.switchTab({
url: '/pages/tabBar/component'
})
},
showToast(){
uni.showToast({
title: 'test title',
icon: 'success',
duration: 2000
})
},
showLoading(){
uni.showLoading({
title: 'test title',
})
},
showModal(){
uni.showModal({
title: 'test title',
content: 'test content',
})
},
showActionSheet(){
uni.showActionSheet({
title: 'test title',
itemList: ['1', '2', '3']
})
}
}
}
</script>
<template>
<view class="uni-padding-wrap">
<page-head title="onLoad 生命周期调用 uni api 测试" />
<text v-if="isTrue">v-if with true</text>
<text v-if="isFalse">v-if with false</text>
<text v-show="isTrue">v-show with true</text>
<text v-show="isFalse">v-show with false</text>
<text>msg: {{ msg }}</text>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
isTrue: false,
isFalse: true,
msg: 'default msg'
}
},
onLoad(options : OnLoadOptions) {
const type = options['type']
switch (type) {
case 'adjustData':
this.adjustData()
break;
case 'navigateTo':
this.navigateTo()
break;
case 'navigateBack':
this.navigateBack()
break;
case 'redirectTo':
this.redirectTo()
break;
case 'reLaunch':
this.reLaunch()
break;
case 'switchTab':
this.switchTab()
break;
case 'showToast':
this.showToast()
break;
case 'showLoading':
this.showLoading()
break;
case 'showModal':
this.showModal()
break;
case 'showActionSheet':
this.showActionSheet()
break;
}
},
// #ifdef WEB
onUnload() {
// web 端页面销毁前,关闭 modal 和 actionsheet
const modalBtn = document.querySelector('.uni-modal__btn')
if (modalBtn) {
modalBtn.click()
}
const actionSheetBtn = document.querySelector('.uni-actionsheet__action .uni-actionsheet__cell')
if (actionSheetBtn) {
actionSheetBtn.click()
}
},
// #endif
methods: {
adjustData() {
this.isTrue = true
this.isFalse = false
this.msg = 'new msg'
},
navigateTo() {
uni.navigateTo({
url: '/pages/API/navigator/new-page/new-page-3'
})
},
navigateBack() {
uni.navigateBack()
},
redirectTo() {
uni.redirectTo({
url: '/pages/API/navigator/new-page/new-page-3'
})
},
reLaunch() {
uni.reLaunch({
url: '/pages/API/navigator/new-page/new-page-3'
})
},
switchTab() {
uni.switchTab({
url: '/pages/tabBar/component'
})
},
showToast() {
uni.showToast({
title: 'test title',
icon: 'success',
duration: 2000
})
},
showLoading() {
uni.showLoading({
title: 'test title',
})
},
showModal() {
uni.showModal({
title: 'test title',
content: 'test content'
})
},
showActionSheet() {
uni.showActionSheet({
title: 'test title',
itemList: ['1', '2', '3']
})
}
}
}
</script>
pages/component/general-attribute/general-attribute.uvue
浏览文件 @
8635bc49
...
...
@@ -76,7 +76,12 @@ export default {
this.validateGeneralAttrText = '基础属性 id 验证失败'
return
}
// #ifdef APP-ANDROID
if (!generalTarget.classList.includes('general-class')) {
// #endif
// #ifdef WEB
if (!Array.from(generalTarget.classList).includes('general-class')) {
// #endif
this.validateGeneralAttrText = '基础属性 class 验证失败'
return
}
...
...
pages/component/general-event/general-event.test.js
浏览文件 @
8635bc49
const
PAGE_PATH
=
'
/pages/component/general-event/general-event
'
describe
(
'
event trigger sequence
'
,
()
=>
{
let
page
let
el
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
el
=
await
page
.
$
(
'
.target
'
)
})
it
(
'
touch
'
,
async
()
=>
{
await
el
.
touchstart
({
touches
:
[
{
identifier
:
1
,
pageX
:
100
,
pageY
:
100
,
},
],
changedTouches
:
[
{
identifier
:
1
,
pageX
:
100
,
pageY
:
100
,
},
],
})
await
el
.
touchmove
({
touches
:
[
{
identifier
:
1
,
pageX
:
100
,
pageY
:
100
,
},
],
changedTouches
:
[
{
identifier
:
1
,
pageX
:
101
,
pageY
:
101
,
},
],
})
await
el
.
touchend
({
touches
:
[],
changedTouches
:
[
{
identifier
:
1
,
pageX
:
101
,
pageY
:
101
,
},
],
})
const
data
=
await
page
.
data
()
expect
(
data
.
onTouchStartTime
).
toBeLessThanOrEqual
(
data
.
onTouchMoveTime
);
expect
(
data
.
onTouchMoveTime
).
toBeLessThanOrEqual
(
data
.
onTouchEndTime
);
})
it
(
'
click
'
,
async
()
=>
{
await
el
.
tap
()
const
data
=
await
page
.
data
()
expect
(
data
.
onTapTime
).
toBeLessThanOrEqual
(
data
.
onClickTime
)
})
it
(
'
longPress
'
,
async
()
=>
{
await
el
.
longpress
()
const
data
=
await
page
.
data
()
expect
(
data
.
onLongPressTime
).
toBeGreaterThan
(
0
)
})
const
PAGE_PATH
=
'
/pages/component/general-event/general-event
'
describe
(
'
event trigger sequence
'
,
()
=>
{
let
page
let
el
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
el
=
await
page
.
$
(
'
.target
'
)
})
it
(
'
touch
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
await
el
.
touchstart
({
touches
:
[{
identifier
:
1
,
pageX
:
100
,
pageY
:
100
,
},
],
changedTouches
:
[{
identifier
:
1
,
pageX
:
100
,
pageY
:
100
,
},
],
})
await
el
.
touchmove
({
touches
:
[{
identifier
:
1
,
pageX
:
100
,
pageY
:
100
,
},
],
changedTouches
:
[{
identifier
:
1
,
pageX
:
101
,
pageY
:
101
,
},
],
})
await
el
.
touchend
({
touches
:
[],
changedTouches
:
[{
identifier
:
1
,
pageX
:
101
,
pageY
:
101
,
},
],
})
const
data
=
await
page
.
data
()
expect
(
data
.
onTouchStartTime
).
toBeLessThanOrEqual
(
data
.
onTouchMoveTime
);
expect
(
data
.
onTouchMoveTime
).
toBeLessThanOrEqual
(
data
.
onTouchEndTime
);
}
})
it
(
'
click
'
,
async
()
=>
{
await
el
.
tap
()
const
data
=
await
page
.
data
()
expect
(
data
.
onTapTime
).
toBeLessThanOrEqual
(
data
.
onClickTime
)
})
it
(
'
longPress
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
await
el
.
longpress
()
const
data
=
await
page
.
data
()
expect
(
data
.
onLongPressTime
).
toBeGreaterThan
(
0
)
}
})
})
pages/tabBar/API.uvue
浏览文件 @
8635bc49
...
...
@@ -153,7 +153,13 @@
{
name: 'element元素',
url: 'get-element-by-id',
api: ["getElementById"]
api: ["getElementById"],
// #ifdef APP-ANDROID
enable: true,
// #endif
// #ifndef APP-ANDROID
enable: false,
// #endif
},
{
name: 'element draw',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录