Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
93ed0963
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6018
Star
91
Fork
164
代码
文件
提交
分支
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看板
提交
93ed0963
编写于
2月 27, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(list-view): 补充边界测试
上级
ae26661a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
62 addition
and
51 deletion
+62
-51
pages/component/list-view/ListViewWrapper.uvue
pages/component/list-view/ListViewWrapper.uvue
+5
-1
pages/component/list-view/list-view-children-in-slot.test.js
pages/component/list-view/list-view-children-in-slot.test.js
+38
-38
pages/component/list-view/list-view-children-in-slot.uvue
pages/component/list-view/list-view-children-in-slot.uvue
+19
-12
未找到文件。
pages/component/list-view/ListViewWrapper.uvue
浏览文件 @
93ed0963
<template>
<list-view>
<slot></slot>
<list-item>start</list-item>
<slot name="default"></slot>
<list-item>middle</list-item>
<slot name="second"></slot>
<list-item>end</list-item>
</list-view>
</template>
pages/component/list-view/list-view-children-in-slot.test.js
浏览文件 @
93ed0963
...
...
@@ -13,38 +13,38 @@ describe('list-view-children-in-slot', () => {
it
(
'
basic
'
,
async
()
=>
{
let
listItems
=
await
page
.
$$
(
'
list-item
'
)
expect
(
listItems
.
length
).
toBe
(
3
)
expect
(
listItems
.
length
).
toBe
(
9
)
let
texts
=
await
page
.
$$
(
'
.text-in-list-item
'
)
for
(
let
i
=
0
;
i
<
texts
.
length
;
i
++
){
expect
(
await
texts
[
i
].
text
()).
toBe
(
`
${
i
}
`
)
for
(
let
i
=
0
;
i
<
texts
.
length
;
i
++
)
{
expect
(
await
texts
[
i
].
text
()).
toBe
(
`
${
i
>
(
texts
.
length
/
2
-
1
)?
i
-
texts
.
length
/
2
:
i
}
`
)
}
const
addBtn
=
await
page
.
$
(
'
#add-btn
'
)
await
addBtn
.
tap
()
listItems
=
await
page
.
$$
(
'
list-item
'
)
expect
(
listItems
.
length
).
toBe
(
4
)
expect
(
listItems
.
length
).
toBe
(
11
)
texts
=
await
page
.
$$
(
'
.text-in-list-item
'
)
for
(
let
i
=
0
;
i
<
texts
.
length
;
i
++
){
expect
(
await
texts
[
i
].
text
()).
toBe
(
`
${
i
}
`
)
for
(
let
i
=
0
;
i
<
texts
.
length
;
i
++
)
{
expect
(
await
texts
[
i
].
text
()).
toBe
(
`
${
i
>
(
texts
.
length
/
2
-
1
)?
i
-
texts
.
length
/
2
:
i
}
`
)
}
const
emptyBtn
=
await
page
.
$
(
'
#empty-btn
'
)
await
emptyBtn
.
tap
()
listItems
=
await
page
.
$$
(
'
list-item
'
)
expect
(
listItems
.
length
).
toBe
(
0
)
expect
(
listItems
.
length
).
toBe
(
3
)
await
addBtn
.
tap
()
listItems
=
await
page
.
$$
(
'
list-item
'
)
expect
(
listItems
.
length
).
toBe
(
1
)
expect
(
listItems
.
length
).
toBe
(
5
)
texts
=
await
page
.
$$
(
'
.text-in-list-item
'
)
for
(
let
i
=
0
;
i
<
texts
.
length
;
i
++
){
expect
(
await
texts
[
i
].
text
()).
toBe
(
`
${
i
}
`
)
for
(
let
i
=
0
;
i
<
texts
.
length
;
i
++
)
{
expect
(
await
texts
[
i
].
text
()).
toBe
(
`
0`
)
}
})
})
pages/component/list-view/list-view-children-in-slot.uvue
浏览文件 @
93ed0963
...
...
@@ -6,9 +6,16 @@
<page-head title="getApp"></page-head>
<view class="uni-padding-wrap">
<list-view-wrapper>
<template #default>
<list-item v-for="item in list" :key="item">
<text class="text-in-list-item">{{item}}</text>
</list-item>
</template>
<template #second>
<list-item v-for="item in list" :key="item">
<text class="text-in-list-item">{{item}}</text>
</list-item>
</template>
</list-view-wrapper>
<button id="add-btn" class="uni-common-mt" @click="addItem">add item</button>
<button id="empty-btn" class="uni-common-mt" @click="emptyList">empty list</button>
...
...
@@ -30,10 +37,10 @@
}
},
methods: {
addItem()
{
addItem()
{
this.list.push(this.list.length)
},
emptyList()
{
emptyList()
{
this.list = []
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录