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

test: overflow增加多层级测试例

上级 cb41b6db
......@@ -62,4 +62,16 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
res = await page.data('jest_result');
expect(res).toBe(true)
})
it('Check Overflow Visible Deep Level Click', async () => {
await page.callMethod('jest_scrollToDeepOverflow')
await page.waitFor(500);
const point_x = await page.data('jest_click_x');
const point_y = await page.data('jest_click_y');
console.log("input tap" + " " + point_x + " " + point_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>
<!-- #ifdef APP -->
<scroll-view style="flex: 1;">
<scroll-view id="scroll-view" style="flex: 1;">
<!-- #endif -->
<view>
<text style="font-size: 15px;">overflow=visible 父view(绿色),子view(红色),点击超出父view区域的部分也可触发事件。</text>
......@@ -30,6 +30,17 @@
</view>
</view>
</view>
<text style="font-size: 15px;">overflow=visible组件多层级设置测试</text>
<view class="backgroundview">
<view id="deep-overflow" style="overflow: visible;">
<view style="overflow: visible;background-color: red;width: 100px;height: 100px;" @click="handleClick('red')">
</view>
</view>
<view style="overflow: visible;">
<view style="overflow: visible;background-color: green;width: 100px;height: 100px;">
</view>
</view>
</view>
</view>
<!-- #ifdef APP -->
</scroll-view>
......@@ -112,6 +123,23 @@
this.jest_click_x = rect.x * ratio + 10
this.jest_click_y = (rect.top + titleBarHeight + 10) * ratio
}
},
jest_scrollToDeepOverflow(){
const scrollView = uni.getElementById('scroll-view') as UniScrollViewElement
const rect = uni.getElementById('deep-overflow')?.getBoundingClientRect()
if (rect != null) {
scrollView.scrollTo(0, rect.top)
setTimeout(()=>{
const systemInfo = uni.getSystemInfoSync()
const ratio = systemInfo.devicePixelRatio
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const afterRect = uni.getElementById('deep-overflow')?.getBoundingClientRect()
if (afterRect != null) {
this.jest_click_x = afterRect.x * ratio + 10
this.jest_click_y = (afterRect.top + titleBarHeight + 10) * ratio
}
}, 200)
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册