Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
b84e8305
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6045
Star
91
Fork
165
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b84e8305
编写于
11月 29, 2024
作者:
shutao-dc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gird-view rename waterflow
上级
7a612fb7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
57 addition
and
57 deletion
+57
-57
pages/component/waterflow/waterflow.test.js
pages/component/waterflow/waterflow.test.js
+9
-9
pages/component/waterflow/waterflow.uvue
pages/component/waterflow/waterflow.uvue
+48
-48
未找到文件。
pages/component/
grid-view/grid-vie
w.test.js
→
pages/component/
waterflow/waterflo
w.test.js
浏览文件 @
b84e8305
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
describe
(
'
component-native-
grid-vie
w
'
,
()
=>
{
describe
(
'
component-native-
waterflo
w
'
,
()
=>
{
if
(
isMP
||
platformInfo
.
indexOf
(
'
web
'
)
>
-
1
)
{
it
(
'
skip mp
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
...
...
@@ -11,8 +11,8 @@ describe('component-native-grid-view', () => {
let
page
beforeAll
(
async
()
=>
{
//打开
grid-vie
w测试页
page
=
await
program
.
reLaunch
(
'
/pages/component/
grid-view/grid-vie
w
'
)
//打开
waterflo
w测试页
page
=
await
program
.
reLaunch
(
'
/pages/component/
waterflow/waterflo
w
'
)
await
page
.
waitFor
(
600
)
})
...
...
@@ -20,7 +20,7 @@ describe('component-native-grid-view', () => {
it
(
'
check_scroll_top
'
,
async
()
=>
{
await
page
.
callMethod
(
'
confirm_scroll_top_input
'
,
600
)
await
page
.
waitFor
(
600
)
const
listElement
=
await
page
.
$
(
'
#
gridvie
w
'
)
const
listElement
=
await
page
.
$
(
'
#
waterflo
w
'
)
const
scrollTop
=
await
listElement
.
attribute
(
"
scrollTop
"
)
console
.
log
(
"
check_scroll_top---
"
+
scrollTop
)
expect
(
scrollTop
-
600
).
toBeGreaterThanOrEqual
(
0
)
...
...
@@ -98,16 +98,16 @@ describe('component-native-grid-view', () => {
it
(
'
check_scroll_into_view_top
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setScrollIntoView
'
,
'
item---3
'
)
await
page
.
waitFor
(
600
)
const
gridElement
=
await
page
.
$
(
'
#gridvie
w
'
)
const
scrollTop
=
await
grid
Element
.
attribute
(
"
scrollTop
"
)
const
waterflowElement
=
await
page
.
$
(
'
#waterflo
w
'
)
const
scrollTop
=
await
waterflow
Element
.
attribute
(
"
scrollTop
"
)
console
.
log
(
"
check_scroll_into_view_top--
"
+
scrollTop
)
await
page
.
callMethod
(
'
setScrollIntoView
'
,
'
item---0
'
)
expect
(
scrollTop
-
280
).
toBeGreaterThanOrEqual
(
0
)
})
//检测
grid-vie
w属性变化 截图校验
it
(
'
check_
grid
_view_props
'
,
async
()
=>
{
await
page
.
callMethod
(
'
testModify
GridVie
wProps
'
)
//检测
waterflo
w属性变化 截图校验
it
(
'
check_
waterflow
_view_props
'
,
async
()
=>
{
await
page
.
callMethod
(
'
testModify
Waterflo
wProps
'
)
await
page
.
waitFor
(
600
)
const
image
=
await
program
.
screenshot
({
fullPage
:
false
});
expect
(
image
).
toSaveImageSnapshot
();
...
...
pages/component/
grid-view/grid-vie
w.uvue
→
pages/component/
waterflow/waterflo
w.uvue
浏览文件 @
b84e8305
...
...
@@ -5,7 +5,7 @@
currentTarget : UniElement | null;
direction ?: string
}
type
grid
ItemData = {
type
flow
ItemData = {
height : number,
text : string
}
...
...
@@ -23,7 +23,7 @@
scroll_top_input: 0,
scroll_left_input: 0,
refresher_background_input: "#FFF",
scrollData: [] as Array<
grid
ItemData>,
scrollData: [] as Array<
flow
ItemData>,
size_enum: [{ "value": 0, "name": "item---0" }, { "value": 3, "name": "item---3" }] as ItemType[],
scrollIntoView: "",
refresherrefresh: false,
...
...
@@ -40,7 +40,7 @@
cross_axis_count: 2,
main_axis_gap: 2,
cross_axis_gap: 2,
gridVie
wPadding: [10, 5, 10, 5] as Array<number>,
waterflo
wPadding: [10, 5, 10, 5] as Array<number>,
loadMore: true,
isLoadMore: true
}
...
...
@@ -68,17 +68,17 @@
{ height: 90, text: "item---17" },
{ height: 130, text: "item---18" },
{ height: 140, text: "item---19" },
] as Array<
grid
ItemData>
] as Array<
flow
ItemData>
},
methods: {
grid_vie
w_click() { console.log("组件被点击时触发") },
grid_vie
w_touchstart() { console.log("手指触摸动作开始") },
grid_vie
w_touchmove() { console.log("手指触摸后移动") },
grid_vie
w_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") },
grid_vie
w_touchend() { console.log("手指触摸动作结束") },
grid_vie
w_tap() { console.log("手指触摸后马上离开") },
grid_vie
w_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
grid_vie
w_refresherpulling(e : RefresherEvent) {
waterflo
w_click() { console.log("组件被点击时触发") },
waterflo
w_touchstart() { console.log("手指触摸动作开始") },
waterflo
w_touchmove() { console.log("手指触摸后移动") },
waterflo
w_touchcancel() { console.log("手指触摸动作被打断,如来电提醒,弹窗") },
waterflo
w_touchend() { console.log("手指触摸动作结束") },
waterflo
w_tap() { console.log("手指触摸后马上离开") },
waterflo
w_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
waterflo
w_refresherpulling(e : RefresherEvent) {
console.log("下拉刷新控件被下拉")
if (this.reset) {
if (e.detail.dy > 45) {
...
...
@@ -88,7 +88,7 @@
}
}
},
grid_vie
w_refresherrefresh() {
waterflo
w_refresherrefresh() {
console.log("下拉刷新被触发 ")
this.refresherrefresh = true
this.refresher_triggered_boolean = true
...
...
@@ -98,14 +98,14 @@
this.refresher_triggered_boolean = false
}, 1500)
},
grid_vie
w_refresherrestore() {
waterflo
w_refresherrestore() {
this.refresherrefresh = false
this.state = 3
this.reset = true
console.log("下拉刷新被复位")
},
grid_vie
w_refresherabort() { console.log("下拉刷新被中止") },
grid_vie
w_scrolltoupper(e : UniScrollToUpperEvent) {
waterflo
w_refresherabort() { console.log("下拉刷新被中止") },
waterflo
w_scrolltoupper(e : UniScrollToUpperEvent) {
console.log("滚动到顶部/左边,会触发 scrolltoupper 事件 direction=" + e.detail.direction)
this.checkEventTest({
type: e.type,
...
...
@@ -114,7 +114,7 @@
direction: e.detail.direction,
} as ScrollEventTest, 'scrolltoupper')
},
grid_vie
w_scrolltolower(e : UniScrollToLowerEvent) {
waterflo
w_scrolltolower(e : UniScrollToLowerEvent) {
console.log("滚动到底部/右边,会触发 scrolltolower 事件 direction=" + e.detail.direction)
this.checkEventTest({
type: e.type,
...
...
@@ -123,7 +123,7 @@
direction: e.detail.direction,
} as ScrollEventTest, 'scrolltolower')
},
grid_vie
w_scroll(e : UniScrollEvent) {
waterflo
w_scroll(e : UniScrollEvent) {
console.log("滚动时触发,event.detail = ", e.detail)
this.scrollDetailTest = e.detail
this.checkEventTest({
...
...
@@ -132,7 +132,7 @@
currentTarget: e.currentTarget
} as ScrollEventTest, 'scroll')
},
grid_vie
w_scrollend(e : UniScrollEvent) {
waterflo
w_scrollend(e : UniScrollEvent) {
console.log("滚动结束时触发", e.detail)
this.scrollEndDetailTest = e.detail
this.checkEventTest({
...
...
@@ -141,13 +141,13 @@
currentTarget: e.currentTarget
} as ScrollEventTest, 'scrollend')
},
grid_item_click() { console.log("grid
-item组件被点击时触发") },
grid_item_touchstart() { console.log("手指触摸grid
-item组件动作开始") },
grid_item_touchmove() { console.log("手指触摸grid
-item组件后移动") },
grid_item_touchcancel() { console.log("手指触摸grid
-item组件动作被打断,如来电提醒,弹窗") },
grid_item_touchend() { console.log("手指触摸grid
-item组件动作结束") },
grid_item_tap() { console.log("手指触摸grid
-item组件后马上离开") },
grid_item_longpress() { console.log("grid
-item组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
flow_item_click() { console.log("flow
-item组件被点击时触发") },
flow_item_touchstart() { console.log("手指触摸flow
-item组件动作开始") },
flow_item_touchmove() { console.log("手指触摸flow
-item组件后移动") },
flow_item_touchcancel() { console.log("手指触摸flow
-item组件动作被打断,如来电提醒,弹窗") },
flow_item_touchend() { console.log("手指触摸flow
-item组件动作结束") },
flow_item_tap() { console.log("手指触摸flow
-item组件后马上离开") },
flow_item_longpress() { console.log("flow
-item组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
change_refresher_triggered_boolean(checked : boolean) { this.refresher_triggered_boolean = checked },
change_refresher_enabled_boolean(checked : boolean) { this.refresher_enabled_boolean = checked },
change_scroll_with_animation_boolean(checked : boolean) { this.scroll_with_animation_boolean = checked },
...
...
@@ -181,7 +181,7 @@
},
//自动化测试例专用
check_scroll_height() : Boolean {
var listElement = this.$refs["
gridvie
w"] as UniElement
var listElement = this.$refs["
waterflo
w"] as UniElement
console.log("check_scroll_height--" + listElement.scrollHeight)
if (listElement.scrollHeight > 1400) {
return true
...
...
@@ -212,11 +212,11 @@
this.main_axis_gap = e.detail.value
},
//仅自动化测试调用
testModify
GridVie
wProps() {
testModify
Waterflo
wProps() {
this.cross_axis_count = 4
this.main_axis_gap = 6
this.cross_axis_gap = 6
this.
gridVie
wPadding = [5, 10, 5, 10] as Array<number>
this.
waterflo
wPadding = [5, 10, 5, 10] as Array<number>
}
}
}
...
...
@@ -224,34 +224,34 @@
<template>
<view class="main">
<
grid-vie
w :cross-axis-count="cross_axis_count" :main-axis-gap="main_axis_gap" :cross-axis-gap="cross_axis_gap"
<
waterflo
w :cross-axis-count="cross_axis_count" :main-axis-gap="main_axis_gap" :cross-axis-gap="cross_axis_gap"
:bounces="bounces_boolean" :upper-threshold="upper_threshold_input" :lower-threshold="lower_threshold_input"
:scroll-top="scroll_top_input" :scroll-left="scroll_left_input" :show-scrollbar="show_scrollbar_boolean"
:scroll-into-view="scrollIntoView" :scroll-with-animation="scroll_with_animation_boolean"
:refresher-enabled="refresher_enabled_boolean" :refresher-background="refresher_background_input"
:refresher-triggered="refresher_triggered_boolean" :refresher-default-style="refresher_default_style_input"
@click="
grid_view_click" @touchstart="grid_view_touchstart" @touchmove="grid_vie
w_touchmove"
@touchcancel="
grid_view_touchcancel" @touchend="grid_view_touchend" @tap="grid_vie
w_tap"
@longpress="
grid_view_longpress" @refresherpulling="grid_vie
w_refresherpulling"
@refresherrefresh="
grid_view_refresherrefresh" @refresherrestore="grid_vie
w_refresherrestore"
@refresherabort="
grid_view_refresherabort" @scrolltoupper="grid_view_scrolltoupper" ref="gridvie
w"
@scrolltolower="
grid_view_scrolltolower" @scroll="grid_view_scroll" @scrollend="grid_vie
w_scrollend"
style="width:100%; " id="
gridview" :padding="gridVie
wPadding">
@click="
waterflow_click" @touchstart="waterflow_touchstart" @touchmove="waterflo
w_touchmove"
@touchcancel="
waterflow_touchcancel" @touchend="waterflow_touchend" @tap="waterflo
w_tap"
@longpress="
waterflow_longpress" @refresherpulling="waterflo
w_refresherpulling"
@refresherrefresh="
waterflow_refresherrefresh" @refresherrestore="waterflo
w_refresherrestore"
@refresherabort="
waterflow_refresherabort" @scrolltoupper="waterflow_scrolltoupper" ref="waterflo
w"
@scrolltolower="
waterflow_scrolltolower" @scroll="waterflow_scroll" @scrollend="waterflo
w_scrollend"
style="width:100%; " id="
waterflow" :padding="waterflo
wPadding">
<
grid-item v-for="(item, index) in scrollData" :key="index" :id="item.text" @click="grid
_item_click"
:style="{'height' : item.height}" @touchstart="
grid_item_touchstart" @touchmove="grid
_item_touchmove"
@touchcancel="
grid_item_touchcancel" @touchend="grid_item_touchend" @tap="grid
_item_tap"
@longpress="
grid_item_longpress" class="grid
-item" type=1>
<
flow-item v-for="(item, index) in scrollData" :key="index" :id="item.text" @click="flow
_item_click"
:style="{'height' : item.height}" @touchstart="
flow_item_touchstart" @touchmove="flow
_item_touchmove"
@touchcancel="
flow_item_touchcancel" @touchend="flow_item_touchend" @tap="flow
_item_tap"
@longpress="
flow_item_longpress" class="flow
-item" type=1>
<text>{{item.text}}</text>
</
grid
-item>
</
flow
-item>
<
grid
-item slot="refresher" id="refresher" type=2 class="refresh-box">
<
flow
-item slot="refresher" id="refresher" type=2 class="refresh-box">
<text class="tip-text">{{text[state]}}</text>
</
grid
-item>
<
grid
-item v-show="isLoadMore" slot="load-more" id="loadmore" type=6 class="load-more-box">
</
flow
-item>
<
flow
-item v-show="isLoadMore" slot="load-more" id="loadmore" type=6 class="load-more-box">
<text>加载更多</text>
</
grid
-item>
</
grid-vie
w>
</
flow
-item>
</
waterflo
w>
</view>
<scroll-view style="flex:1" direction="vertical">
...
...
@@ -302,7 +302,7 @@
justify-content: center;
}
.
grid
-item {
.
flow
-item {
width: 100%;
height: 200px;
border: 1px solid #666;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录