提交 3db69b1a 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

feat: overflow:visible 超出部分点击测试例

上级 54fcd4b6
...@@ -1288,6 +1288,13 @@ ...@@ -1288,6 +1288,13 @@
{ {
"navigationBarTitleText" : "resize0bserver" "navigationBarTitleText" : "resize0bserver"
} }
},
{
"path" : "pages/CSS/overflow/overflow-visible-event",
"style" :
{
"navigationBarTitleText" : "overflow-visible-event"
}
} }
// #endif // #endif
], ],
......
// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
if (!process.env.uniTestPlatformInfo.startsWith('android')) {
it('dummyTest', async () => {
expect(1).toBe(1)
})
return
}
let page;
let res;
beforeAll(async () => {
page = await program.reLaunch('/pages/CSS/overflow/overflow-visible-event')
await page.waitFor(600);
})
beforeEach(async () => {
await page.setData({
jest_result: false,
})
});
it('Check Overflow Visible Part Click', async () => {
res = await page.callMethod('jest_getRect')
const point_x = await page.data('jest_click_x');
const point_y = await page.data('jest_click_y');
await program.adbCommand("input tap" + " " + point_x + " " + point_y)
await page.waitFor(500);
res = await page.data('jest_result');
expect(res).toBe(true)
});
});
<template>
<view>
<text style="font-size: 15px;">overflow=visible 点击子view(超出父view区域的部分)</text>
<view class="backgroundview">
<view class="box-visible-border-radius">
<view id="child" style="width: 50px; height: 150px; background-color: greenyellow;"
@click="handleClickOverflowPart" @touchmove="handleTouchMoveOverflowPart">
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
jest_result: false,
jest_click_x: -1,
jest_click_y: -1
}
},
methods: {
handleClickOverflowPart() {
console.log("click");
this.jest_result = true;
},
handleTouchMoveOverflowPart() {
console.log("move");
},
jest_getRect() {
const rect = uni.getElementById('child')?.getBoundingClientRect()
if (rect != null) {
const ratio = uni.getSystemInfoSync().devicePixelRatio
this.jest_click_x = rect.x * ratio + 10
this.jest_click_y = rect.bottom * ratio - 10
}
}
}
}
</script>
<style>
.backgroundview {
width: 300px;
height: 300px;
margin-bottom: 20px;
background-color: white;
justify-content: center;
align-items: center;
}
.box-visible-border-radius {
width: 100px;
height: 100px;
border-radius: 20px;
overflow: visible;
background-color: green;
}
</style>
...@@ -273,7 +273,11 @@ ...@@ -273,7 +273,11 @@
{ {
name: 'overflow', name: 'overflow',
url: '/pages/CSS/overflow/overflow', url: '/pages/CSS/overflow/overflow',
}, },
{
name: 'overflow-visible-event',
url: '/pages/CSS/overflow/overflow-visible-event'
}
] as Page[], ] as Page[],
}, },
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册