提交 96f98bb6 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新text示例和自动化测试用例

上级 2bb3d33e
...@@ -22,7 +22,8 @@ describe('text-props', () => { ...@@ -22,7 +22,8 @@ describe('text-props', () => {
expect(width).toBe(0) expect(width).toBe(0)
expect(height).toBe(0) expect(height).toBe(0)
} }
page.callMethod("setTextEmpty") await page.callMethod("setTextEmpty")
await page.waitFor(100)
const element2 = await page.$('#empty-text2') const element2 = await page.$('#empty-text2')
if (element2 != null) { if (element2 != null) {
const { width, height } = await element2.size() const { width, height } = await element2.size()
...@@ -34,15 +35,18 @@ describe('text-props', () => { ...@@ -34,15 +35,18 @@ describe('text-props', () => {
}) })
}) })
if (process.env.uniTestPlatformInfo.indexOf('web') > -1) {
return
}
it('text nested', async () => { it('text nested', async () => {
page.callMethod("setTextNested") await page.setData({
autoTest: true
})
await page.callMethod("setTextNested")
await page.waitFor(100)
const element = await page.$('#text-nested') const element = await page.$('#text-nested')
if (element != null) { if (element != null) {
expect(await element.text()).toBe("二级节点文字红色且背景色黄色") expect(await element.text()).toBe("修改三级节点")
} }
await page.setData({
autoTest: false
})
}) })
}) })
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<view class="text-box"> <view class="text-box">
<text <text
>一级节点黑色 >一级节点黑色
<text id="text-nested" ref="text-nested" style="color: red;background-color: yellow;" <text style="color: red;background-color: yellow;"
>二级节点红色且背景色黄色 >二级节点红色且背景色黄色
<text>三级节点不继承二级的颜色</text> <text>三级节点不继承二级的颜色</text>
</text> </text>
...@@ -96,11 +96,20 @@ ...@@ -96,11 +96,20 @@
<text class="text-padding" style="width: 200px;height: 100px;">hello uni-app x</text> <text class="text-padding" style="width: 200px;height: 100px;">hello uni-app x</text>
</view> </view>
<view class="uni-row" v-if="autoTest"> <view v-if="autoTest">
<view class="uni-row">
<text id="empty-text"></text> <text id="empty-text"></text>
</view> </view>
<view class="uni-row" v-if="autoTest"> <view class="uni-row">
<text id="empty-text2" ref="empty-text2">test</text> <text id="empty-text2">{{emptyText}}</text>
</view>
<text
>一级节点
<text
>二级节点
<text id="text-nested">{{nestedText}}</text>
</text>
</text>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
...@@ -115,16 +124,18 @@ export default { ...@@ -115,16 +124,18 @@ export default {
'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言', 'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言',
singleLineText: 'uni-app x,终极跨平台方案', singleLineText: 'uni-app x,终极跨平台方案',
// 自动化测试 // 自动化测试
autoTest: false autoTest: false,
nestedText: '三级节点',
emptyText: 'empty'
} }
}, },
methods: { methods: {
// 自动化测试 // 自动化测试
setTextNested() { setTextNested() {
(this.$refs["text-nested"] as UniElement).setAttribute("value", "二级节点文字红色且背景色黄色"); this.nestedText = "修改三级节点";
}, },
setTextEmpty() { setTextEmpty() {
(this.$refs["empty-text2"] as UniElement).setAttribute("value", ""); this.emptyText = "";
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册