Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
9088e1b2
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看板
提交
9088e1b2
编写于
8月 23, 2024
作者:
辛宝Otto
🥊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 补充动态切换 border 截图测试
上级
a31c4674
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
109 addition
and
51 deletion
+109
-51
.editorconfig
.editorconfig
+1
-1
pages/CSS/border/dynamic-border.test.js
pages/CSS/border/dynamic-border.test.js
+38
-15
pages/CSS/border/dynamic-border.uvue
pages/CSS/border/dynamic-border.uvue
+70
-35
未找到文件。
.editorconfig
浏览文件 @
9088e1b2
...
...
@@ -2,7 +2,7 @@ root = true
[*]
charset = utf-8
end_of_line =
lf
end_of_line =
auto
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
...
...
pages/CSS/border/dynamic-border.test.js
浏览文件 @
9088e1b2
...
...
@@ -4,27 +4,50 @@ describe('css-dynamic-border', () => {
page
=
await
program
.
reLaunch
(
'
/pages/CSS/border/dynamic-border
'
)
await
page
.
waitFor
(
600
);
})
// 左上、右上设置圆角
it
(
'
check_topleft_topright
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
// 取消圆角
it
(
'
check_none
'
,
async
()
=>
{
it
(
'
check_none
'
,
async
()
=>
{
await
page
.
callMethod
(
'
changeIndex
'
,
2
)
await
page
.
waitFor
(
100
)
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
// 左下,右下设置圆角
it
(
'
check_bottomleft_bottomright
'
,
async
()
=>
{
await
page
.
callMethod
(
'
changeIndex
'
,
10
)
await
page
.
waitFor
(
100
)
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
it
(
'
动态切换为空值
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setBorderBlank
'
)
await
page
.
waitFor
(
100
)
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
// 左下,右下设置圆角
it
(
'
check_bottomleft_bottomright
'
,
async
()
=>
{
await
page
.
callMethod
(
'
changeIndex
'
,
10
)
await
page
.
waitFor
(
100
)
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
})
it
(
'
动态切换空值为有值
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setBorderBlank
'
)
await
page
.
waitFor
(
100
)
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
})
})
pages/CSS/border/dynamic-border.uvue
浏览文件 @
9088e1b2
<template>
<view style="margin: 15px;border-radius: 10px;background-color: white;">
<view
v-for="index in 10" :key="index"
:class="(index < 9 ? 'bb1' : '') + ' ' + (currentIndex == 0 ? 'btlr10 btrr10' : currentIndex == 9 ? 'bblr10 bbrr10' : '')"
style="flex-direction: row;align-items: center;padding: 15px"
:style="index == currentIndex ? 'background-color :#57BE6A;' : ''"
@tap="currentIndex = index">
<view>
<text style="font-size: 14px;" :style="index == currentIndex ? 'color: #FFFFFF;' : ''">{{ index }}</text>
</view>
</view>
</view>
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<!-- #endif -->
<view style="margin: 15px;border-radius: 10px;background-color: white;">
<view v-for="index in 10" :key="index"
:class="(index < 9 ? 'bb1' : '') + ' ' + (currentIndex == 0 ? 'btlr10 btrr10' : currentIndex == 9 ? 'bblr10 bbrr10' : '')"
style="flex-direction: row;align-items: center;padding: 15px"
:style="index == currentIndex ? 'background-color :#57BE6A;' : ''" @tap="currentIndex = index">
<view>
<text style="font-size: 14px;" :style="index == currentIndex ? 'color: #FFFFFF;' : ''">{{ index }}</text>
</view>
</view>
</view>
<view style="margin: 15px;margin-top: 20px;">
<text>动态切换 border 为空值</text>
<text @click="setBorderBlank" class="common" :style="style">
{{isSelect?'选中':'未选中'}}
</text>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
currentIndex: 1,
}
},
const defaultStyle = 'border:2px solid black;background :#57BE6A;'
export default {
data() {
return {
currentIndex: 1,
style: '' as string,
}
},
computed: {
isSelect() : boolean {
return this.style == defaultStyle
}
},
methods: {
changeIndex(index: number) {
changeIndex(index
: number) {
this.currentIndex = index
},
setBorderBlank() {
this.style = this.style == '' ? defaultStyle : ''
}
}
}
}
</script>
<style>
.bb1{
border-bottom: 1rpx solid #EEEEEE;
}
.btlr10{
border-top-left-radius: 10rpx;
}
.btrr10{
border-top-right-radius: 10rpx;
}
.bblr10{
border-bottom-left-radius: 10rpx;
}
.bbrr10{
border-bottom-right-radius: 10rpx;
}
.common {
padding: 15px;
border-radius: 4px;
width: 120px;
text-align: center;
margin-top: 10px;
}
.bb1 {
border-bottom: 1rpx solid #EEEEEE;
}
.btlr10 {
border-top-left-radius: 10rpx;
}
.btrr10 {
border-top-right-radius: 10rpx;
}
.bblr10 {
border-bottom-left-radius: 10rpx;
}
.bbrr10 {
border-bottom-right-radius: 10rpx;
}
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录