提交 9088e1b2 编写于 作者: 辛宝Otto's avatar 辛宝Otto 🥊

feat: 补充动态切换 border 截图测试

上级 a31c4674
...@@ -2,7 +2,7 @@ root = true ...@@ -2,7 +2,7 @@ root = true
[*] [*]
charset = utf-8 charset = utf-8
end_of_line = lf end_of_line = auto
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
trim_trailing_whitespace = true trim_trailing_whitespace = true
......
...@@ -4,27 +4,50 @@ describe('css-dynamic-border', () => { ...@@ -4,27 +4,50 @@ describe('css-dynamic-border', () => {
page = await program.reLaunch('/pages/CSS/border/dynamic-border') page = await program.reLaunch('/pages/CSS/border/dynamic-border')
await page.waitFor(600); await page.waitFor(600);
}) })
// 左上、右上设置圆角 // 左上、右上设置圆角
it('check_topleft_topright', async () => { it('check_topleft_topright', async () => {
const image = await program.screenshot({fullPage: true}); const image = await program.screenshot({
fullPage: true
});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
// 取消圆角 // 取消圆角
it('check_none', async () => { it('check_none', async () => {
await page.callMethod('changeIndex', 2) await page.callMethod('changeIndex', 2)
await page.waitFor(100) 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(); expect(image).toSaveImageSnapshot();
}) })
it('动态切换空值为有值', async () => {
// 左下,右下设置圆角 await page.callMethod('setBorderBlank')
it('check_bottomleft_bottomright', async () => { await page.waitFor(100)
await page.callMethod('changeIndex', 10) const image = await program.screenshot({
await page.waitFor(100) fullPage: true
const image = await program.screenshot({fullPage: true}); });
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
}) })
}) })
<template> <template>
<view style="margin: 15px;border-radius: 10px;background-color: white;"> <!-- #ifdef APP -->
<view <scroll-view style="flex: 1">
v-for="index in 10" :key="index" <!-- #endif -->
:class="(index < 9 ? 'bb1' : '') + ' ' + (currentIndex == 0 ? 'btlr10 btrr10' : currentIndex == 9 ? 'bblr10 bbrr10' : '')" <view style="margin: 15px;border-radius: 10px;background-color: white;">
style="flex-direction: row;align-items: center;padding: 15px" <view v-for="index in 10" :key="index"
:style="index == currentIndex ? 'background-color :#57BE6A;' : ''" :class="(index < 9 ? 'bb1' : '') + ' ' + (currentIndex == 0 ? 'btlr10 btrr10' : currentIndex == 9 ? 'bblr10 bbrr10' : '')"
@tap="currentIndex = index"> style="flex-direction: row;align-items: center;padding: 15px"
<view> :style="index == currentIndex ? 'background-color :#57BE6A;' : ''" @tap="currentIndex = index">
<text style="font-size: 14px;" :style="index == currentIndex ? 'color: #FFFFFF;' : ''">{{ index }}</text> <view>
</view> <text style="font-size: 14px;" :style="index == currentIndex ? 'color: #FFFFFF;' : ''">{{ index }}</text>
</view> </view>
</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> </template>
<script> <script>
export default { const defaultStyle = 'border:2px solid black;background :#57BE6A;'
data() { export default {
return {
currentIndex: 1, data() {
} return {
}, currentIndex: 1,
style: '' as string,
}
},
computed: {
isSelect() : boolean {
return this.style == defaultStyle
}
},
methods: { methods: {
changeIndex(index: number) { changeIndex(index : number) {
this.currentIndex = index this.currentIndex = index
},
setBorderBlank() {
this.style = this.style == '' ? defaultStyle : ''
} }
} }
} }
</script> </script>
<style> <style>
.bb1{ .common {
border-bottom: 1rpx solid #EEEEEE; padding: 15px;
} border-radius: 4px;
.btlr10{ width: 120px;
border-top-left-radius: 10rpx; text-align: center;
} margin-top: 10px;
.btrr10{ }
border-top-right-radius: 10rpx;
} .bb1 {
.bblr10{ border-bottom: 1rpx solid #EEEEEE;
border-bottom-left-radius: 10rpx; }
}
.bbrr10{ .btlr10 {
border-bottom-right-radius: 10rpx; border-top-left-radius: 10rpx;
} }
.btrr10 {
border-top-right-radius: 10rpx;
}
.bblr10 {
border-bottom-left-radius: 10rpx;
}
.bbrr10 {
border-bottom-right-radius: 10rpx;
}
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册