提交 eb2461ad 编写于 作者: shutao-dc's avatar shutao-dc

update nodes-info.test.js nodes-info.uvue 补充自动化测试例

上级 66d88e0b
......@@ -44,4 +44,10 @@ describe('nodes-info', () => {
expect(Math.round(nodeInfo2.width)).toBe(RECT_WIDTH)
expect(Math.round(nodeInfo2.height)).toBe(RECT_HEIGHT)
})
//检测onResize获取BoundingClientRect信息是否有效
it('check_resizeRectValid', async () => {
const resizeRectValid = await page.data('resizeRectValid')
expect(resizeRectValid).toBe(true)
})
})
......@@ -3,7 +3,7 @@
<page-head :title="title"></page-head>
<button class="btn btn-get-node-info" @click="getNodeInfo">getNodeInfo</button>
<button class="btn btn-get-all-node-info" @click="getAllNodeInfo">getAllNodeInfo</button>
<view class="rect-1-2">
<view id="rect-1-2" class="rect-1-2">
<view class="rect rect1"></view>
<view class="rect rect2"></view>
</view>
......@@ -53,6 +53,18 @@
return {
title: 'createSelectorQuery',
nodeInfoList: [] as NodeInfoType[],
//供自动化测试使用
resizeRectValid: false
}
},
onResize() {
//供自动化测试使用
var rect12Element = uni.getElementById("rect-1-2")
if(rect12Element != null) {
var domRect = rect12Element.getBoundingClientRect()
if(domRect.width > 100) {
this.resizeRectValid = true
}
}
},
methods: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册