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

update: overflow-visible-event.uvue 自动化测试例获取位置的辅助方法

上级 223824af
...@@ -101,26 +101,25 @@ ...@@ -101,26 +101,25 @@
const rect = uni.getElementById('child')?.getBoundingClientRect() const rect = uni.getElementById('child')?.getBoundingClientRect()
if (rect != null) { if (rect != null) {
let ratio = 1 let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){ if (uni.getSystemInfoSync().platform == 'android'){
ratio = uni.getSystemInfoSync().devicePixelRatio ratio = uni.getSystemInfoSync().devicePixelRatio
} }
const systemInfo = uni.getSystemInfoSync() const systemInfo = uni.getSystemInfoSync()
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
this.jest_click_x = rect.x * ratio + 30 this.jest_click_x = rect.x * ratio + 30
this.jest_click_y = (rect.bottom + titleBarHeight - 40) * ratio this.jest_click_y = rect.bottom * ratio - 30
} }
}, },
jest_getParentRect() { jest_getParentRect() {
const transform = uni.getElementById('parent')?.style.getPropertyValue("transform") const transform = uni.getElementById('parent')?.style.getPropertyValue("transform")
if (transform != null) { if (transform != null) {
let value = transform as string let value = transform as string
value = value.split(",")[1].slice(0, -3) value = value.split(",")[1].slice(0, -3)
let ratio = 1 let ratio = 1
if (uni.getSystemInfoSync().platform == 'android'){ if (uni.getSystemInfoSync().platform == 'android'){
ratio = uni.getSystemInfoSync().devicePixelRatio ratio = uni.getSystemInfoSync().devicePixelRatio
} }
this.jest_parent_top = Math.round((parseFloat(value) * ratio)) this.jest_parent_top = Math.round((parseFloat(value) * ratio))
} }
}, },
jest_getAbsoluteViewRect() { jest_getAbsoluteViewRect() {
...@@ -133,7 +132,7 @@ ...@@ -133,7 +132,7 @@
ratio = uni.getSystemInfoSync().devicePixelRatio ratio = uni.getSystemInfoSync().devicePixelRatio
} }
this.jest_click_x = rect.x * ratio + 30 this.jest_click_x = rect.x * ratio + 30
this.jest_click_y = (rect.top + titleBarHeight + 30) * ratio this.jest_click_y = (rect.top + titleBarHeight) * ratio + 30
} }
}, },
jest_scrollToDeepOverflow() { jest_scrollToDeepOverflow() {
...@@ -151,7 +150,7 @@ ...@@ -151,7 +150,7 @@
const afterRect = uni.getElementById('deep-overflow')?.getBoundingClientRect() const afterRect = uni.getElementById('deep-overflow')?.getBoundingClientRect()
if (afterRect != null) { if (afterRect != null) {
this.jest_click_x = afterRect.x * ratio + 30 this.jest_click_x = afterRect.x * ratio + 30
this.jest_click_y = (afterRect.top + titleBarHeight + 30) * ratio this.jest_click_y = (afterRect.top + titleBarHeight) * ratio + 30
} }
}, 200) }, 200)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册