Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
5b3b259c
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6001
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看板
提交
5b3b259c
编写于
3月 15, 2024
作者:
DCloud_iOS_WZT
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://gitcode.net/dcloud/hello-uni-app-x
into dev
上级
cbe83fe9
bf22549a
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
493 addition
and
293 deletion
+493
-293
main.uts
main.uts
+6
-2
pages.json
pages.json
+7
-9
pages/API/action-sheet/action-sheet.uvue
pages/API/action-sheet/action-sheet.uvue
+7
-1
pages/API/download-file/download-file.test.js
pages/API/download-file/download-file.test.js
+2
-2
pages/API/get-provider/get-provider.uvue
pages/API/get-provider/get-provider.uvue
+87
-0
pages/API/navigator/new-page/onLoad.test.js
pages/API/navigator/new-page/onLoad.test.js
+3
-3
pages/API/request/request.test.js
pages/API/request/request.test.js
+8
-2
pages/API/request/request.uvue
pages/API/request/request.uvue
+19
-0
pages/API/toast/toast.uvue
pages/API/toast/toast.uvue
+2
-2
pages/API/upload-file/upload-file.test.js
pages/API/upload-file/upload-file.test.js
+9
-9
pages/CSS/overflow/overflow.test.js
pages/CSS/overflow/overflow.test.js
+7
-7
pages/component/button/button.test.js
pages/component/button/button.test.js
+7
-0
pages/component/button/button.uvue
pages/component/button/button.uvue
+14
-9
pages/component/button/buttonstatus.uvue
pages/component/button/buttonstatus.uvue
+186
-169
pages/component/general-event/general-event.test.js
pages/component/general-event/general-event.test.js
+3
-3
pages/component/image/image.test.js
pages/component/image/image.test.js
+1
-1
pages/component/input/input.test.js
pages/component/input/input.test.js
+5
-5
pages/component/input/input.uvue
pages/component/input/input.uvue
+1
-2
pages/component/scroll-view/scroll-view-custom-refresher-props.uvue
...onent/scroll-view/scroll-view-custom-refresher-props.uvue
+6
-5
pages/component/scroll-view/scroll-view-refresher-props.uvue
pages/component/scroll-view/scroll-view-refresher-props.uvue
+2
-2
pages/component/scroll-view/scroll-view-refresher.test.js
pages/component/scroll-view/scroll-view-refresher.test.js
+11
-11
pages/component/sticky-section/sticky-section.test.js
pages/component/sticky-section/sticky-section.test.js
+2
-2
pages/component/text/text-props.test.js
pages/component/text/text-props.test.js
+39
-7
pages/component/text/text-props.uvue
pages/component/text/text-props.uvue
+29
-6
pages/component/web-view-local/web-view-local.test.js
pages/component/web-view-local/web-view-local.test.js
+1
-1
pages/component/web-view/web-view.test.js
pages/component/web-view/web-view.test.js
+1
-1
pages/pages.test.js
pages/pages.test.js
+16
-16
pages/template/custom-refresher/custom-refresher.uvue
pages/template/custom-refresher/custom-refresher.uvue
+5
-9
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
...reenshot-comparison/webview-screenshot-comparison.test.js
+4
-4
pages/webview-screenshot/webview-screenshot.test.js
pages/webview-screenshot/webview-screenshot.test.js
+3
-3
未找到文件。
main.uts
浏览文件 @
5b3b259c
...
@@ -3,15 +3,19 @@ import App from './App.uvue'
...
@@ -3,15 +3,19 @@ import App from './App.uvue'
import { createSSRApp } from 'vue'
import { createSSRApp } from 'vue'
export function createApp() {
export function createApp() {
const app = createSSRApp(App)
const app = createSSRApp(App)
app.config.errorHandler = (err, vm, info) => {
console.log(err, vm, info)
}
app.mixin({
app.mixin({
onReady() {
onReady() {
// #ifdef APP-ANDROID
setTimeout(() => {
setTimeout(() => {
console.log((this as BasePage).$nativePage!.getDomJson())
console.log((this as BasePage).$nativePage!.getDomJson())
}, 100)
}, 100)
// #endif
}
}
})
})
return {
return {
app
app
}
}
}
}
pages.json
浏览文件 @
5b3b259c
...
@@ -269,7 +269,6 @@
...
@@ -269,7 +269,6 @@
"navigationBarTitleText"
:
"web-view-local"
"navigationBarTitleText"
:
"web-view-local"
}
}
},
},
//
#ifndef
APP-IOS
{
{
"path"
:
"pages/component/unicloud-db-contacts/list"
,
"path"
:
"pages/component/unicloud-db-contacts/list"
,
"style"
:
{
"style"
:
{
...
@@ -301,7 +300,6 @@
...
@@ -301,7 +300,6 @@
"navigationBarTitleText"
:
"mixinDatacom"
"navigationBarTitleText"
:
"mixinDatacom"
}
}
},
},
//
#endif
{
{
"path"
:
"pages/component/general-attribute/general-attribute"
,
"path"
:
"pages/component/general-attribute/general-attribute"
,
"style"
:
{
"style"
:
{
...
@@ -576,6 +574,13 @@
...
@@ -576,6 +574,13 @@
"navigationBarTitleText"
:
"get-system-setting"
"navigationBarTitleText"
:
"get-system-setting"
}
}
},
},
{
"path"
:
"pages/API/element-takesnapshot/element-takesnapshot"
,
"style"
:
{
"navigationBarTitleText"
:
"takeSnapshot"
,
"enablePullDownRefresh"
:
false
}
},
//
#endif
//
#endif
//
#ifndef
WEB
//
#ifndef
WEB
{
{
...
@@ -655,13 +660,6 @@
...
@@ -655,13 +660,6 @@
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
},
},
{
"path"
:
"pages/API/element-takesnapshot/element-takesnapshot"
,
"style"
:
{
"navigationBarTitleText"
:
"takeSnapshot"
,
"enablePullDownRefresh"
:
false
}
},
{
{
"path"
:
"pages/API/element-draw/element-draw"
,
"path"
:
"pages/API/element-draw/element-draw"
,
"style"
:
{
"style"
:
{
...
...
pages/API/action-sheet/action-sheet.uvue
浏览文件 @
5b3b259c
...
@@ -116,7 +116,13 @@
...
@@ -116,7 +116,13 @@
icon: "none"
icon: "none"
})
})
},
},
fail: (e) => {
fail: (e) => {
if(this.showErrorToast){
uni.showToast({
title: e.errMsg,
icon: "none"
})
}
console.log(e);
console.log(e);
}
}
})
})
...
...
pages/API/download-file/download-file.test.js
浏览文件 @
5b3b259c
...
@@ -23,7 +23,7 @@ describe('ExtApi-DownloadFile', () => {
...
@@ -23,7 +23,7 @@ describe('ExtApi-DownloadFile', () => {
});
});
let
shouldTestCookie
=
false
let
shouldTestCookie
=
false
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
version
=
process
.
env
.
uniTestPlatformInfo
let
version
=
process
.
env
.
uniTestPlatformInfo
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
shouldTestCookie
=
version
>
9
shouldTestCookie
=
version
>
9
...
@@ -47,4 +47,4 @@ describe('ExtApi-DownloadFile', () => {
...
@@ -47,4 +47,4 @@ describe('ExtApi-DownloadFile', () => {
res
=
await
page
.
data
(
'
jest_result
'
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
expect
(
res
).
toBe
(
true
)
});
});
});
});
pages/API/get-provider/get-provider.uvue
0 → 100644
浏览文件 @
5b3b259c
<template>
<!-- #ifdef APP -->
<scroll-view class="page-scroll-view">
<!-- #endif -->
<view class="page">
<page-head :title="title"></page-head>
<view class="service-item" v-for="(item, index) in serviceList" :key="index">
<text class="service-name">{{item.name}}:</text>
<view class="provider-list">
<text class="provider-item" v-for="(item2, index2) in item.provider" :key="index2">{{item2}}</text>
</view>
</view>
<button class="btn-get-provider" type="primary" @click="getProvider">getProvider</button>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
type ProviderItem = {
service : string,
name : string,
provider : string[]
}
export default {
data() {
return {
title: 'provider',
serviceList: [
{ service: "oauth", name: "登陆", provider: [] },
{ service: "share", name: "分享", provider: [] },
{ service: "payment", name: "支付", provider: [] },
{ service: "push", name: "推送", provider: [] },
{ service: "location", name: "定位", provider: [] }
] as ProviderItem[]
}
},
methods: {
getProvider() {
this.serviceList.forEach((item : ProviderItem) => {
uni.getProvider({
service: item.service,
success: (e) => {
this.updateProvider(e.service, e.provider);
}
})
})
},
updateProvider(service : string, provider : string[]) {
const item : ProviderItem | null = this.serviceList.find((item : ProviderItem) : boolean => {
return item.service == service
});
if (item != null) {
item.provider = provider
}
}
}
}
</script>
<style>
.page {
padding: 15px;
}
.service-item {
margin-top: 10px;
}
.service-name {
font-weight: bold;
}
.provider-list {
margin-left: 32px;
}
.provider-item {
line-height: 1.5;
}
.btn-get-provider {
margin-top: 30px;
}
</style>
pages/API/navigator/new-page/onLoad.test.js
浏览文件 @
5b3b259c
...
@@ -22,7 +22,7 @@ describe("onLoad", () => {
...
@@ -22,7 +22,7 @@ describe("onLoad", () => {
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
expect
(
page
.
path
).
toBe
(
TARGET_PAGE_PATH
.
substring
(
1
));
});
});
it
(
"
navigateBack
"
,
async
()
=>
{
it
(
"
navigateBack
"
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
waitFor
(
'
view
'
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateBack
"
);
await
page
.
callMethod
(
"
navigateToOnLoadWithType
"
,
"
navigateBack
"
);
...
@@ -89,7 +89,7 @@ describe("onLoad", () => {
...
@@ -89,7 +89,7 @@ describe("onLoad", () => {
expect
(
image
).
toMatchImageSnapshot
({
expect
(
image
).
toMatchImageSnapshot
({
failureThreshold
:
0.05
,
failureThreshold
:
0.05
,
failureThresholdType
:
"
percent
"
,
failureThresholdType
:
"
percent
"
,
});
});
});
});
it
(
"
showModal
"
,
async
()
=>
{
it
(
"
showModal
"
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
page
=
await
program
.
reLaunch
(
INTERMEDIATE_PAGE_PATH
);
...
@@ -127,4 +127,4 @@ describe("onLoad", () => {
...
@@ -127,4 +127,4 @@ describe("onLoad", () => {
failureThresholdType
:
"
percent
"
,
failureThresholdType
:
"
percent
"
,
});
});
});
});
});
});
pages/API/request/request.test.js
浏览文件 @
5b3b259c
...
@@ -86,7 +86,7 @@ describe('ExtApi-Request', () => {
...
@@ -86,7 +86,7 @@ describe('ExtApi-Request', () => {
});
});
let
shouldTestCookie
=
false
let
shouldTestCookie
=
false
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
version
=
process
.
env
.
uniTestPlatformInfo
let
version
=
process
.
env
.
uniTestPlatformInfo
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
shouldTestCookie
=
version
>
9
shouldTestCookie
=
version
>
9
...
@@ -108,4 +108,10 @@ describe('ExtApi-Request', () => {
...
@@ -108,4 +108,10 @@ describe('ExtApi-Request', () => {
res
=
await
page
.
data
(
'
jest_result
'
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
expect
(
res
).
toBe
(
true
)
});
});
});
it
(
'
Check Get With Data
'
,
async
()
=>
{
res
=
await
page
.
callMethod
(
'
jest_get_with_data
'
)
await
page
.
waitFor
(
2000
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
})
});
pages/API/request/request.uvue
浏览文件 @
5b3b259c
...
@@ -300,6 +300,25 @@
...
@@ -300,6 +300,25 @@
this.jest_result = false;
this.jest_result = false;
},
},
});
});
},
jest_get_with_data() {
uni.request({
url: "https://unidemo.dcloud.net.cn/api/banner/36kr",
method: "GET",
data:{
column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名
},
timeout: 6000,
sslVerify: false,
withCredentials: false,
firstIpv4: false,
success: () => {
this.jest_result = true;
},
fail: () => {
this.jest_result = false;
},
});
},
},
}
}
}
}
...
...
pages/API/toast/toast.uvue
浏览文件 @
5b3b259c
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<!-- #ifndef MP-ALIPAY -->
<!-- #ifndef MP-ALIPAY -->
<button class="uni-btn-v" type="default" @tap="toast4Tap">点击弹出显示自定义图片的toast</button>
<button class="uni-btn-v" type="default" @tap="toast4Tap">点击弹出显示自定义图片的toast</button>
<!-- #endif -->
<!-- #endif -->
<!-- #ifdef APP
-PLUS
-->
<!-- #ifdef APP -->
<button class="uni-btn-v" type="default" @tap="toast5Tap" id="btn-toast-postion-bottom">点击显示无图标的居底toast</button>
<button class="uni-btn-v" type="default" @tap="toast5Tap" id="btn-toast-postion-bottom">点击显示无图标的居底toast</button>
<!-- #endif -->
<!-- #endif -->
<button class="uni-btn-v" type="default" @tap="hideToast" id="btn-toast-hide">点击隐藏toast</button>
<button class="uni-btn-v" type="default" @tap="hideToast" id="btn-toast-hide">点击隐藏toast</button>
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
},
},
})
})
},
},
// #ifdef APP
-PLUS
// #ifdef APP
toast5Tap: function () {
toast5Tap: function () {
uni.showToast({
uni.showToast({
title: "显示一段轻提示",
title: "显示一段轻提示",
...
...
pages/API/upload-file/upload-file.test.js
浏览文件 @
5b3b259c
...
@@ -27,17 +27,17 @@ describe('ExtApi-UploadFile', () => {
...
@@ -27,17 +27,17 @@ describe('ExtApi-UploadFile', () => {
it
(
'
Check
'
,
async
()
=>
{
it
(
'
Check
'
,
async
()
=>
{
expect
(
res
).
toBe
(
true
);
expect
(
res
).
toBe
(
true
);
});
});
it
(
'
Check files upload
'
,
async
()
=>
{
it
(
'
Check files upload
'
,
async
()
=>
{
res
=
await
page
.
callMethod
(
'
jest_files_upload
'
)
res
=
await
page
.
callMethod
(
'
jest_files_upload
'
)
await
page
.
waitFor
(
2000
);
await
page
.
waitFor
(
2000
);
res
=
await
page
.
data
(
'
jest_result
'
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
expect
(
res
).
toBe
(
true
)
});
});
let
shouldTestCookie
=
false
let
shouldTestCookie
=
false
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
version
=
process
.
env
.
uniTestPlatformInfo
let
version
=
process
.
env
.
uniTestPlatformInfo
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
shouldTestCookie
=
version
>
9
shouldTestCookie
=
version
>
9
...
@@ -59,4 +59,4 @@ describe('ExtApi-UploadFile', () => {
...
@@ -59,4 +59,4 @@ describe('ExtApi-UploadFile', () => {
res
=
await
page
.
data
(
'
jest_result
'
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
expect
(
res
).
toBe
(
true
)
});
});
});
});
pages/CSS/overflow/overflow.test.js
浏览文件 @
5b3b259c
describe
(
'
component-native-overflow
'
,
()
=>
{
describe
(
'
component-native-overflow
'
,
()
=>
{
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
//打开list-view测试页
//打开list-view测试页
page
=
await
program
.
reLaunch
(
'
/pages/CSS/overflow/overflow
'
)
page
=
await
program
.
reLaunch
(
'
/pages/CSS/overflow/overflow
'
)
await
page
.
waitFor
(
"
image
"
)
await
page
.
waitFor
(
"
image
"
)
})
})
//检测overflow设置hidden,visible
//检测overflow设置hidden,visible
it
(
'
check_view_overflow
'
,
async
()
=>
{
it
(
'
check_view_overflow
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
version
=
process
.
env
.
uniTestPlatformInfo
let
version
=
process
.
env
.
uniTestPlatformInfo
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
//安卓7模拟器不截图 导致闪退
//安卓7模拟器不截图 导致闪退
...
@@ -21,5 +21,5 @@ describe('component-native-overflow', () => {
...
@@ -21,5 +21,5 @@ describe('component-native-overflow', () => {
fullPage
:
true
,
fullPage
:
true
,
});
});
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
})
})
})
pages/component/button/button.test.js
浏览文件 @
5b3b259c
...
@@ -86,4 +86,11 @@ describe('Button.uvue', () => {
...
@@ -86,4 +86,11 @@ describe('Button.uvue', () => {
const
value
=
await
page
.
callMethod
(
'
checkUniButtonElement
'
)
const
value
=
await
page
.
callMethod
(
'
checkUniButtonElement
'
)
expect
(
value
).
toBe
(
true
)
expect
(
value
).
toBe
(
true
)
})
})
it
(
"
setbuttonEmpty
"
,
async
()
=>
{
const
textBtn
=
await
page
.
$
(
'
.btn
'
)
await
page
.
setData
({
text
:
''
,
})
expect
(
await
textBtn
.
text
()).
toEqual
(
''
)
})
})
})
pages/component/button/button.uvue
浏览文件 @
5b3b259c
...
@@ -35,14 +35,14 @@
...
@@ -35,14 +35,14 @@
uni.navigateTo({
uni.navigateTo({
url: 'buttonstatus',
url: 'buttonstatus',
})
})
},
},
//用于自动化测试
//用于自动化测试
checkUniButtonElement()
: boolean {
checkUniButtonElement()
: boolean {
const button = uni.getElementById("testButton")
const button = uni.getElementById("testButton")
if
(button != null && button instanceof UniButtonElement) {
if
(button != null && button instanceof UniButtonElement) {
return true
return true
}
}
return false
return false
}
}
}
}
}
}
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
<boolean-data :defaultValue="false" title="修改默认样式和点击效果(高优先)" @change="change_default_style"></boolean-data>
<boolean-data :defaultValue="false" title="修改默认样式和点击效果(高优先)" @change="change_default_style"></boolean-data>
<enum-data :items="size_enum" title="按钮的大小" @change="radio_change_size_enum"></enum-data>
<enum-data :items="size_enum" title="按钮的大小" @change="radio_change_size_enum"></enum-data>
<enum-data :items="type_enum" title="按钮的类型" @change="radio_change_type_enum"></enum-data>
<enum-data :items="type_enum" title="按钮的类型" @change="radio_change_type_enum"></enum-data>
<input-data :defaultValue="text" title="按钮的文案" type="text" @confirm="confirm_text_input"></input-data>
<input-data :defaultValue="text" title="按钮的文案" type="text" @confirm="confirm_text_input"></input-data>
<view style="height: 10px;"></view>
<view style="height: 10px;"></view>
<button @click="navigateToChild">更多示例</button>
<button @click="navigateToChild">更多示例</button>
</view>
</view>
...
@@ -97,4 +97,9 @@
...
@@ -97,4 +97,9 @@
background-color: #179b16;
background-color: #179b16;
border-color: #179b16;
border-color: #179b16;
}
}
.button-hover {
color: rgba(0, 0, 0, 0.6);
background-color: #dedede;
}
</style>
</style>
pages/component/button/buttonstatus.uvue
浏览文件 @
5b3b259c
<script>
<script>
import { ItemType } from '@/components/enum-data/enum-data'
import { ItemType } from '@/components/enum-data/enum-data'
export default {
export default {
data() {
data() {
return {
return {
plain_boolean: false,
plain_boolean: false,
disabled_boolean: false,
disabled_boolean: false,
default_style: false,
default_style: false,
size_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "mini" }] as ItemType[],
size_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "mini" }] as ItemType[],
size_enum_current: 0,
size_enum_current: 0,
type_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "primary" }, { "value": 2, "name": "warn" }] as ItemType[],
type_enum: [{ "value": 0, "name": "default" }, { "value": 1, "name": "primary" }, { "value": 2, "name": "warn" }] as ItemType[],
type_enum_current: 0,
type_enum_current: 0,
count: 0,
count: 0,
text: 'uni-app-x'
text: 'uni-app-x'
}
}
},
},
methods: {
methods: {
button_click() {
button_click() {
console.log("组件被点击时触发")
console.log("组件被点击时触发")
this.count++
this.count++
},
},
button_touchstart() { console.log("手指触摸动作开始") },
button_touchstart() { console.log("手指触摸动作开始") },
button_touchmove() { console.log("手指触摸后移动") },
button_touchmove() { console.log("手指触摸后移动") },
button_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") },
button_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") },
button_touchend() { console.log("手指触摸动作结束") },
button_touchend() { console.log("手指触摸动作结束") },
button_tap() { console.log("手指触摸后马上离开") },
button_tap() { console.log("手指触摸后马上离开") },
button_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
button_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
change_plain_boolean(checked : boolean) { this.plain_boolean = checked },
change_plain_boolean(checked : boolean) { this.plain_boolean = checked },
change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },
change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },
change_default_style(checked : boolean) { this.default_style = checked },
change_default_style(checked : boolean) { this.default_style = checked },
radio_change_size_enum(checked : number) { this.size_enum_current = checked },
radio_change_size_enum(checked : number) { this.size_enum_current = checked },
radio_change_type_enum(checked : number) { this.type_enum_current = checked },
radio_change_type_enum(checked : number) { this.type_enum_current = checked },
confirm_text_input(value : string) { this.text = value }
confirm_text_input(value : string) { this.text = value }
}
}
}
}
</script>
</script>
<template>
<template>
<view class="main">
<scroll-view direction="vertical" style="flex:1">
<!--type-->
<view class="main">
<view class="container">
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
<!--type-->
:type="type_enum[0].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
<view class="container">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:type="type_enum[0].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
type-default
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
</button>
:hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
type-default
<view class="container">
</button>
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
</view>
:type="type_enum[1].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
<view class="container">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:type="type_enum[1].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
type-primary
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
</button>
:hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
type-primary
<view class="container">
</button>
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
</view>
:type="type_enum[2].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
<view class="container">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:type="type_enum[2].name" :plain="plain_boolean" @click="button_click" @touchstart="button_touchstart"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
type-warn
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
</button>
:hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
type-warn
<!--size-->
</button>
<view class="container">
</view>
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[0].name"
<!--size-->
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
<view class="container">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[0].name"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
size-default
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
</button>
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
size-default
<view class="container">
</button>
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[1].name"
</view>
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
<view class="container">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[1].name"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
size-mini
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
</button>
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
size-mini
<!--plain-->
</button>
<view class="container">
</view>
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
<!--plain-->
:type="type_enum[type_enum_current].name" :plain="true" @click="button_click" @touchstart="button_touchstart"
<view class="container">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:type="type_enum[type_enum_current].name" :plain="true" @click="button_click" @touchstart="button_touchstart"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
plain-true
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
</button>
:hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
plain-true
<view class="container">
</button>
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
</view>
:type="type_enum[type_enum_current].name" :plain="false" @click="button_click" @touchstart="button_touchstart"
<view class="container">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
<button style="margin: 10px;" :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
:type="type_enum[type_enum_current].name" :plain="false" @click="button_click" @touchstart="button_touchstart"
:hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchmove="button_touchmove" @touchcancel="button_touchcancel" @touchend="button_touchend" @tap="button_tap"
plain-false
@longpress="button_longpress" class="btn" :class="default_style ? 'custom-btn' : ''"
</button>
:hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
plain-false
<!--disable-->
</button>
<view class="container">
</view>
<button style="margin: 10px;" :disabled="false" :size="size_enum[size_enum_current].name"
<!--disable-->
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
<view class="container">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
<button style="margin: 10px;" :disabled="false" :size="size_enum[size_enum_current].name"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
disable-false
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
</button>
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
disable-false
<view class="container">
</button>
<button style="margin: 10px;" :disabled="true" :size="size_enum[size_enum_current].name"
</view>
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
<view class="container">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
<button style="margin: 10px;" :disabled="true" :size="size_enum[size_enum_current].name"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
disable-true
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
</button>
:class="default_style ? 'custom-btn' : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
</view>
disable-true
<view class="container">
</button>
<button style="margin: 10px;position: relative;text-align:left;padding:5px;color: #ffffff;background-color: #1AAD19;
</view>
font-size: 10px;line-height: 2;">
<view class="container">
custom-btn
<button style="margin: 10px;position: relative;text-align:left;padding:5px;color: #ffffff;background-color: #1AAD19;
</button>
font-size: 10px;line-height: 2;">
</view>
custom-btn
<view class="container">
</button>
<button style="margin: 10px;
</view>
font-size: 15px;color: red;" type="warn" plain="true">
<view class="container">
custom-btn-plain-warn
<button style="margin: 10px;
</button>
font-size: 15px;color: red;" type="warn" plain="true">
</view>
custom-btn-plain-warn
<view class="content">
</button>
<button style="margin: 10px;" type="primary" size="default" :disabled="disabled_boolean">uni-app x</button>
</view>
<button style="margin: 10px;" type="primary" @tap="change_disabled_boolean(!disabled_boolean)">修改disabled为{{disabled_boolean}}</button>
<view class="content">
</view>
<button style="margin: 10px;" type="primary" size="default" :disabled="disabled_boolean">uni-app x</button>
</view>
<button style="margin: 10px;" type="primary"
</template>
@tap="change_disabled_boolean(!disabled_boolean)">修改disabled为{{!disabled_boolean}}</button>
</view>
<style>
<view class="content">
.main {
<button style="margin: 10px;" type="primary" size="default" :disabled="disabled_boolean" hover-class="none">hover-class none</button>
padding: 5px 0;
</view>
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
flex-direction: column;
</view>
justify-content: center;
</scroll-view>
}
</template>
.main .list-item {
<style>
width: 100%;
.main {
height: 100px;
padding: 5px 0;
border: 1px solid #666;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
flex-direction: column;
justify-content: center;
.custom-btn {
}
color: #ffffff;
background-color: #1AAD19;
.main .list-item {
border-color: #1AAD19;
width: 100%;
border-radius: 5px;
height: 100px;
border-width: 0.5px;
border: 1px solid #666;
height: 53px;
}
.custom-btn {
color: #ffffff;
background-color: #1AAD19;
border-color: #1AAD19;
border-radius: 5px;
border-width: 0.5px;
height: 53px;
}
.is-hover {
color: rgba(255, 255, 255, 0.6);
background-color: #179b16;
border-color: #179b16;
}
.container {
width: 100%;
height: 60px;
}
}
.is-hover {
.is-hover {
color: rgba(255, 255, 255, 0.6);
color: rgba(255, 255, 255, 0.6);
background-color: #179b16;
background-color: #179b16;
border-color: #179b16;
border-color: #179b16;
}
}
.container {
.button-hover {
width: 100%;
color: rgba(0, 0, 0, 0.6);
height: 60px;
background-color: #dedede;
/* background-color: orange; */
}
}
</style>
</style>
pages/component/general-event/general-event.test.js
浏览文件 @
5b3b259c
...
@@ -10,7 +10,7 @@ describe('event trigger sequence', () => {
...
@@ -10,7 +10,7 @@ describe('event trigger sequence', () => {
})
})
it
(
'
touch
'
,
async
()
=>
{
it
(
'
touch
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
await
el
.
touchstart
({
await
el
.
touchstart
({
touches
:
[{
touches
:
[{
identifier
:
1
,
identifier
:
1
,
...
@@ -56,10 +56,10 @@ describe('event trigger sequence', () => {
...
@@ -56,10 +56,10 @@ describe('event trigger sequence', () => {
})
})
it
(
'
longPress
'
,
async
()
=>
{
it
(
'
longPress
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
await
el
.
longpress
()
await
el
.
longpress
()
const
data
=
await
page
.
data
()
const
data
=
await
page
.
data
()
expect
(
data
.
onLongPressTime
).
toBeGreaterThan
(
0
)
expect
(
data
.
onLongPressTime
).
toBeGreaterThan
(
0
)
}
}
})
})
})
})
pages/component/image/image.test.js
浏览文件 @
5b3b259c
...
@@ -30,7 +30,7 @@ describe('component-native-image', () => {
...
@@ -30,7 +30,7 @@ describe('component-native-image', () => {
expect
(
await
page
.
data
(
'
loadError
'
)).
toBe
(
true
)
expect
(
await
page
.
data
(
'
loadError
'
)).
toBe
(
true
)
})
})
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
it
(
'
check-cookie
'
,
async
()
=>
{
it
(
'
check-cookie
'
,
async
()
=>
{
await
page
.
setData
({
await
page
.
setData
({
autoTest
:
true
,
autoTest
:
true
,
...
...
pages/component/input/input.test.js
浏览文件 @
5b3b259c
...
@@ -147,19 +147,19 @@ describe('component-native-input', () => {
...
@@ -147,19 +147,19 @@ describe('component-native-input', () => {
expect
(
await
(
await
page
.
$
(
'
#uni-input-cursor-color
'
)).
attribute
(
"
cursor-color
"
)).
toBe
(
"
red
"
)
expect
(
await
(
await
page
.
$
(
'
#uni-input-cursor-color
'
)).
attribute
(
"
cursor-color
"
)).
toBe
(
"
red
"
)
})
})
it
(
"
maxlength
default
"
,
async
()
=>
{
it
(
"
maxlength
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
#uni-input-
disable
'
);
const
input
=
await
page
.
$
(
'
#uni-input-
maxlength
'
);
let
str
=
""
;
let
str
=
""
;
for
(
let
i
=
0
;
i
<
200
;
i
++
){
for
(
let
i
=
0
;
i
<
200
;
i
++
){
str
+=
`
${
i
}
`
str
+=
`
${
i
}
`
}
}
await
page
.
setData
({
await
page
.
setData
({
disable
Value
:
str
inputMaxLength
Value
:
str
})
})
let
length
=
(
await
input
.
attribute
(
"
value
"
)).
length
let
length
=
(
await
input
.
attribute
(
"
value
"
)).
length
expect
(
length
).
toBe
(
1
4
0
)
expect
(
length
).
toBe
(
10
)
await
page
.
setData
({
await
page
.
setData
({
disable
Value
:
""
inputMaxLength
Value
:
""
})
})
})
})
...
...
pages/component/input/input.uvue
浏览文件 @
5b3b259c
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
<text class="uni-title-text">设置禁用输入框</text>
<text class="uni-title-text">设置禁用输入框</text>
</view>
</view>
<view class="input-wrapper">
<view class="input-wrapper">
<input id="uni-input-disable" class="uni-input" :disabled="true"
:value="disableValue"
/>
<input id="uni-input-disable" class="uni-input" :disabled="true"/>
</view>
</view>
</view>
</view>
...
@@ -266,7 +266,6 @@
...
@@ -266,7 +266,6 @@
inputPasswordValue: "",
inputPasswordValue: "",
inputFocusKeyBoardChangeValue: true,
inputFocusKeyBoardChangeValue: true,
holdKeyboard: false,
holdKeyboard: false,
disableValue: ""
}
}
},
},
methods: {
methods: {
...
...
pages/component/scroll-view/scroll-view-custom-refresher-props.uvue
浏览文件 @
5b3b259c
<template>
<template>
<scroll-view style="flex:1;" :refresher-enabled="true" :refresher-triggered="refresherTriggered"
<scroll-view style="flex:1;" :refresher-enabled="true" :refresher-triggered="refresherTriggered"
refresher-default-style="none" @refresherpulling="onRefresherpulling" @refresherrefresh="onRefresherrefresh">
refresher-default-style="none" @refresherpulling="onRefresherpulling" @refresherrefresh="onRefresherrefresh"
@refresherrestore="onRefreshrestore"
>
<view style="height: 25px;"></view>
<view style="height: 25px;"></view>
<view v-for="i in 20" class="content-item">
<view v-for="i in 20" class="content-item">
<text class="text">item-{{i}}</text>
<text class="text">item-{{i}}</text>
...
@@ -38,9 +38,6 @@
...
@@ -38,9 +38,6 @@
methods: {
methods: {
onRefresherpulling(e : RefresherEvent) {
onRefresherpulling(e : RefresherEvent) {
this.pullingDistance = e.detail.dy;
this.pullingDistance = e.detail.dy;
if (this.pullingDistance.toDouble() == 0.0) {
this.resetting = false;
}
},
},
onRefresherrefresh() {
onRefresherrefresh() {
this.refresherTriggered = true
this.refresherTriggered = true
...
@@ -48,7 +45,11 @@
...
@@ -48,7 +45,11 @@
this.refresherTriggered = false
this.refresherTriggered = false
this.resetting = true;
this.resetting = true;
}, 1500)
}, 1500)
},
},
onRefreshrestore() {
this.pullingDistance = 0
this.resetting = false;
}
}
}
}
}
</script>
</script>
...
...
pages/component/scroll-view/scroll-view-refresher-props.uvue
浏览文件 @
5b3b259c
...
@@ -64,10 +64,10 @@
...
@@ -64,10 +64,10 @@
data() {
data() {
return {
return {
items: [] as Item[],
items: [] as Item[],
refresherEnabled:
fals
e,
refresherEnabled:
tru
e,
refresherTriggered: false,
refresherTriggered: false,
refresherThreshold: 45,
refresherThreshold: 45,
refresherDefaultStyle: "
white
",
refresherDefaultStyle: "
black
",
refresherBackground: "transparent",
refresherBackground: "transparent",
}
}
},
},
...
...
pages/component/scroll-view/scroll-view-refresher.test.js
浏览文件 @
5b3b259c
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-scroll-view-refresher
'
,
()
=>
{
describe
(
'
component-native-scroll-view-refresher
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
page
;
let
page
;
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/scroll-view/scroll-view-refresher
'
);
page
=
await
program
.
reLaunch
(
'
/pages/component/scroll-view/scroll-view-refresher
'
);
await
page
.
waitFor
(
300
);
await
page
.
waitFor
(
300
);
});
});
it
(
'
scroll-view-refresher-screenshot
'
,
async
()
=>
{
it
(
'
scroll-view-refresher-screenshot
'
,
async
()
=>
{
//禁止滚动条
//禁止滚动条
await
page
.
setData
({
await
page
.
setData
({
showScrollbar
:
false
showScrollbar
:
false
})
})
await
page
.
waitFor
(
300
);
await
page
.
waitFor
(
300
);
const
image
=
await
program
.
screenshot
();
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
})
it
(
'
check_refresher
'
,
async
()
=>
{
it
(
'
check_refresher
'
,
async
()
=>
{
...
@@ -30,4 +30,4 @@ describe('component-native-scroll-view-refresher', () => {
...
@@ -30,4 +30,4 @@ describe('component-native-scroll-view-refresher', () => {
expect
(
1
).
toBe
(
1
)
expect
(
1
).
toBe
(
1
)
})
})
}
}
});
});
pages/component/sticky-section/sticky-section.test.js
浏览文件 @
5b3b259c
...
@@ -19,7 +19,7 @@ describe('component-native-sticky-section', () => {
...
@@ -19,7 +19,7 @@ describe('component-native-sticky-section', () => {
await
page
.
setData
({
await
page
.
setData
({
scrolling
:
'
true
'
scrolling
:
'
true
'
})
})
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
//跳转到id为C的StickyHeader位置
//跳转到id为C的StickyHeader位置
await
page
.
callMethod
(
'
gotoStickyHeader
'
,
'
C
'
)
await
page
.
callMethod
(
'
gotoStickyHeader
'
,
'
C
'
)
}
}
...
@@ -29,4 +29,4 @@ describe('component-native-sticky-section', () => {
...
@@ -29,4 +29,4 @@ describe('component-native-sticky-section', () => {
const
image
=
await
program
.
screenshot
();
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
})
})
})
pages/component/text/text-props.test.js
浏览文件 @
5b3b259c
...
@@ -13,23 +13,55 @@ describe('text-props', () => {
...
@@ -13,23 +13,55 @@ describe('text-props', () => {
})
})
it
(
'
empty text
'
,
async
()
=>
{
it
(
'
empty text
'
,
async
()
=>
{
await
page
.
setData
({
autoTest
:
true
})
const
element
=
await
page
.
$
(
'
#empty-text
'
)
const
element
=
await
page
.
$
(
'
#empty-text
'
)
if
(
element
!=
null
)
{
if
(
element
!=
null
)
{
const
{
width
,
height
}
=
await
element
.
size
()
const
{
width
,
height
}
=
await
element
.
size
()
expect
(
width
).
toBe
(
0
)
expect
(
width
).
toBe
(
0
)
expect
(
height
).
toBe
(
0
)
expect
(
height
).
toBe
(
0
)
}
}
await
page
.
callMethod
(
"
setEmptyText
"
)
await
page
.
waitFor
(
100
)
const
element2
=
await
page
.
$
(
'
#empty-text2
'
)
if
(
element2
!=
null
)
{
const
{
width
,
height
}
=
await
element2
.
size
()
expect
(
width
).
toBe
(
0
)
expect
(
height
).
toBe
(
0
)
}
await
page
.
setData
({
autoTest
:
false
})
})
})
if
(
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
web
'
)
>
-
1
)
{
it
(
'
nested text
'
,
async
()
=>
{
return
await
page
.
setData
({
}
autoTest
:
true
})
await
page
.
callMethod
(
"
setNestedText
"
)
await
page
.
waitFor
(
100
)
const
element
=
await
page
.
$
(
'
#nested-text
'
)
if
(
element
!=
null
)
{
expect
(
await
element
.
text
()).
toBe
(
"
修改三级节点文本
"
)
}
await
page
.
setData
({
autoTest
:
false
})
})
it
(
'
text nested
'
,
async
()
=>
{
it
(
'
height text
'
,
async
()
=>
{
page
.
callMethod
(
"
setTextNested
"
)
await
page
.
setData
({
const
element
=
await
page
.
$
(
'
#text-nested
'
)
autoTest
:
true
})
await
page
.
callMethod
(
"
setHeightText
"
)
await
page
.
waitFor
(
100
)
const
element
=
await
page
.
$
(
'
#height-text
'
)
if
(
element
!=
null
)
{
if
(
element
!=
null
)
{
expect
(
await
element
.
text
()).
toBe
(
"
二级节点文字红色且背景色黄色
"
)
expect
(
await
element
.
text
()).
toBe
(
"
修改设置高度文本
"
)
}
}
await
page
.
setData
({
autoTest
:
false
})
})
})
})
})
pages/component/text/text-props.uvue
浏览文件 @
5b3b259c
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
<view class="text-box">
<view class="text-box">
<text
<text
>一级节点黑色
>一级节点黑色
<text
id="text-nested" ref="text-nested"
style="color: red;background-color: yellow;"
<text style="color: red;background-color: yellow;"
>二级节点红色且背景色黄色
>二级节点红色且背景色黄色
<text>三级节点不继承二级的颜色</text>
<text>三级节点不继承二级的颜色</text>
</text>
</text>
...
@@ -96,10 +96,22 @@
...
@@ -96,10 +96,22 @@
<text class="text-padding" style="width: 200px;height: 100px;">hello uni-app x</text>
<text class="text-padding" style="width: 200px;height: 100px;">hello uni-app x</text>
</view>
</view>
<view class="uni-row">
<view v-if="autoTest">
<text id="empty-text"></text>
<view class="uni-row">
<text id="empty-text"></text>
</view>
<view class="uni-row">
<text id="empty-text2">{{emptyText}}</text>
</view>
<text
>一级节点文本
<text
>二级节点文本
<text id="nested-text">{{nestedText}}</text>
</text>
</text>
<text id="height-text" style="height: 50px;">{{heightText}}</text>
</view>
</view>
</view>
</view>
</scroll-view>
</scroll-view>
</template>
</template>
...
@@ -112,12 +124,23 @@ export default {
...
@@ -112,12 +124,23 @@ export default {
multiLineText:
multiLineText:
'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言',
'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言',
singleLineText: 'uni-app x,终极跨平台方案',
singleLineText: 'uni-app x,终极跨平台方案',
// 自动化测试
autoTest: false,
nestedText: '三级节点文本',
emptyText: '空文本',
heightText: '设置高度文本'
}
}
},
},
methods: {
methods: {
// 自动化测试
// 自动化测试
setTextNested() {
setNestedText() {
(this.$refs["text-nested"] as UniTextElement).value = "二级节点文字红色且背景色黄色";
this.nestedText = "修改三级节点文本";
},
setEmptyText() {
this.emptyText = "";
},
setHeightText() {
this.heightText = "修改设置高度文本";
}
}
}
}
}
}
...
...
pages/component/web-view-local/web-view-local.test.js
浏览文件 @
5b3b259c
...
@@ -12,7 +12,7 @@ describe('component-native-web-view', () => {
...
@@ -12,7 +12,7 @@ describe('component-native-web-view', () => {
});
});
it
(
'
screenshot
'
,
async
()
=>
{
it
(
'
screenshot
'
,
async
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
await
page
.
waitFor
(
async
()
=>
{
await
page
.
waitFor
(
async
()
=>
{
return
await
page
.
data
(
'
loadFinish
'
)
===
true
;
return
await
page
.
data
(
'
loadFinish
'
)
===
true
;
});
});
...
...
pages/component/web-view/web-view.test.js
浏览文件 @
5b3b259c
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-web-view
'
,
()
=>
{
describe
(
'
component-native-web-view
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
page
;
let
page
;
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/web-view/web-view
'
);
page
=
await
program
.
reLaunch
(
'
/pages/component/web-view/web-view
'
);
...
...
pages/pages.test.js
浏览文件 @
5b3b259c
...
@@ -121,7 +121,7 @@ const pages = [
...
@@ -121,7 +121,7 @@ const pages = [
// '/pages/API/element-draw/element-draw',
// '/pages/API/element-draw/element-draw',
]
]
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
)
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
// 规避 web 端不支持页面
// 规避 web 端不支持页面
pages
.
push
(
pages
.
push
(
"
/pages/component/list-view/list-view
"
,
"
/pages/component/list-view/list-view
"
,
...
@@ -133,18 +133,18 @@ if (process.env.uniTestPlatformInfo.startsWith('android')) {
...
@@ -133,18 +133,18 @@ if (process.env.uniTestPlatformInfo.startsWith('android')) {
'
/pages/template/pull-zoom-image/pull-zoom-image
'
,
'
/pages/template/pull-zoom-image/pull-zoom-image
'
,
'
/pages/template/scroll-fold-nav/scroll-fold-nav
'
,
'
/pages/template/scroll-fold-nav/scroll-fold-nav
'
,
'
/pages/template/scroll-sticky/scroll-sticky
'
,
'
/pages/template/scroll-sticky/scroll-sticky
'
,
'
/pages/template/custom-refresher/custom-refresher
'
,
'
/pages/template/custom-refresher/custom-refresher
'
,
'
/pages/template/custom-tab-bar/custom-tab-bar
'
,
'
/pages/template/custom-tab-bar/custom-tab-bar
'
,
'
/pages/template/half-screen/half-screen
'
,
'
/pages/template/half-screen/half-screen
'
,
)
)
}
}
// 设置position: fixed的页面不能截取完整内容
// 设置position: fixed的页面不能截取完整内容
const
notFullPages
=
[
const
notFullPages
=
[
'
/pages/CSS/layout/position
'
,
'
/pages/CSS/layout/position
'
,
'
/pages/CSS/layout/z-index
'
'
/pages/CSS/layout/z-index
'
]
]
let
page
;
let
page
;
describe
(
"
page screenshot test
"
,
()
=>
{
describe
(
"
page screenshot test
"
,
()
=>
{
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
...
@@ -162,14 +162,14 @@ describe("page screenshot test", () => {
...
@@ -162,14 +162,14 @@ describe("page screenshot test", () => {
});
});
test
.
each
(
pages
)(
"
%s
"
,
async
()
=>
{
test
.
each
(
pages
)(
"
%s
"
,
async
()
=>
{
console
.
log
(
"
Taking screenshot:
"
,
pageIndex
,
pages
[
pageIndex
]);
console
.
log
(
"
Taking screenshot:
"
,
pageIndex
,
pages
[
pageIndex
]);
let
fullPage
=
true
;
let
fullPage
=
true
;
if
(
notFullPages
.
includes
(
pages
[
pageIndex
]))
{
if
(
notFullPages
.
includes
(
pages
[
pageIndex
]))
{
fullPage
=
false
;
fullPage
=
false
;
}
}
const
image
=
await
program
.
screenshot
({
const
image
=
await
program
.
screenshot
({
fullPage
:
fullPage
fullPage
:
fullPage
});
});
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
await
page
.
waitFor
(
500
);
await
page
.
waitFor
(
500
);
});
});
});
});
pages/template/custom-refresher/custom-refresher.uvue
浏览文件 @
5b3b259c
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
:refresher-enabled="true" :refresher-triggered="refresherTriggered" refresher-default-style="none"
:refresher-enabled="true" :refresher-triggered="refresherTriggered" refresher-default-style="none"
@refresherpulling="onRefresherpulling"
@refresherpulling="onRefresherpulling"
@refresherrefresh="onRefresherrefresh"
@refresherrefresh="onRefresherrefresh"
@refresherrestore="onRefreshrestore"
:refresher-threshold="refresherThreshold"
:refresher-threshold="refresherThreshold"
>
>
<view v-for="i in 20" class="content-item">
<view v-for="i in 20" class="content-item">
...
@@ -43,9 +44,6 @@
...
@@ -43,9 +44,6 @@
onRefresherpulling(e:RefresherEvent){
onRefresherpulling(e:RefresherEvent){
// console.log('onRefresherpulling',e.detail.dy)
// console.log('onRefresherpulling',e.detail.dy)
this.pullingDistance = e.detail.dy
this.pullingDistance = e.detail.dy
if (this.pullingDistance.toDouble() == 0.0) {
this.resetting = false;
}
},
},
onRefresherrefresh(){
onRefresherrefresh(){
this.refresherTriggered = true
this.refresherTriggered = true
...
@@ -53,12 +51,10 @@
...
@@ -53,12 +51,10 @@
this.refresherTriggered = false
this.refresherTriggered = false
},1500)
},1500)
},
},
// onRefresherrestore(e:RefresherEvent){
onRefreshrestore() {
// console.log('onRefresherrestore',e)
this.pullingDistance = 0
// },
this.resetting = false;
// onRefresherabort(e:RefresherEvent){
}
// console.log('onRefresherabort',e)
// },
}
}
}
}
</script>
</script>
...
...
pages/webview-screenshot-comparison/webview-screenshot-comparison.test.js
浏览文件 @
5b3b259c
...
@@ -8,7 +8,7 @@ const pages = [
...
@@ -8,7 +8,7 @@ const pages = [
"
pages/component/text/text-props
"
,
"
pages/component/text/text-props
"
,
"
pages/component/progress/progress
"
,
"
pages/component/progress/progress
"
,
"
pages/component/form/form
"
,
"
pages/component/form/form
"
,
"
pages/component/button/button
"
,
"
pages/component/button/button
"
,
"
pages/component/button/buttonstatus
"
,
"
pages/component/button/buttonstatus
"
,
"
pages/component/radio/radio
"
,
"
pages/component/radio/radio
"
,
"
pages/component/rich-text/rich-text
"
,
"
pages/component/rich-text/rich-text
"
,
...
@@ -237,7 +237,7 @@ const PAGE_PATH =
...
@@ -237,7 +237,7 @@ const PAGE_PATH =
describe
(
"
shot-compare
"
,
()
=>
{
describe
(
"
shot-compare
"
,
()
=>
{
let
shouldCompareScreenShot
=
false
let
shouldCompareScreenShot
=
false
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
version
=
process
.
env
.
uniTestPlatformInfo
let
version
=
process
.
env
.
uniTestPlatformInfo
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
shouldCompareScreenShot
=
version
>
9
shouldCompareScreenShot
=
version
>
9
...
@@ -246,7 +246,7 @@ describe("shot-compare", () => {
...
@@ -246,7 +246,7 @@ describe("shot-compare", () => {
if
(
!
shouldCompareScreenShot
)
{
if
(
!
shouldCompareScreenShot
)
{
it
(
"
other platform not support
"
,
async
()
=>
{
it
(
"
other platform not support
"
,
async
()
=>
{
expect
(
1
).
toBe
(
1
);
expect
(
1
).
toBe
(
1
);
});
});
return
return
}
}
...
@@ -355,4 +355,4 @@ describe("shot-compare", () => {
...
@@ -355,4 +355,4 @@ describe("shot-compare", () => {
},
},
});
});
});
});
});
});
pages/webview-screenshot/webview-screenshot.test.js
浏览文件 @
5b3b259c
...
@@ -236,7 +236,7 @@ const PAGE_PATH =
...
@@ -236,7 +236,7 @@ const PAGE_PATH =
describe
(
"
shot-compare
"
,
()
=>
{
describe
(
"
shot-compare
"
,
()
=>
{
let
shouldCompareScreenShot
=
false
let
shouldCompareScreenShot
=
false
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
version
=
process
.
env
.
uniTestPlatformInfo
let
version
=
process
.
env
.
uniTestPlatformInfo
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
version
=
parseInt
(
version
.
split
(
"
"
)[
1
])
shouldCompareScreenShot
=
version
>
9
shouldCompareScreenShot
=
version
>
9
...
@@ -245,7 +245,7 @@ describe("shot-compare", () => {
...
@@ -245,7 +245,7 @@ describe("shot-compare", () => {
if
(
!
shouldCompareScreenShot
)
{
if
(
!
shouldCompareScreenShot
)
{
it
(
"
other platform not support
"
,
async
()
=>
{
it
(
"
other platform not support
"
,
async
()
=>
{
expect
(
1
).
toBe
(
1
);
expect
(
1
).
toBe
(
1
);
});
});
return
return
}
}
let
page
=
null
;
let
page
=
null
;
...
@@ -330,4 +330,4 @@ describe("shot-compare", () => {
...
@@ -330,4 +330,4 @@ describe("shot-compare", () => {
},
},
});
});
});
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录