diff --git a/pages/component/text/text-props.test.js b/pages/component/text/text-props.test.js
index 8c60a266d2c777d7badd04572209396b6c5b681c..d82b503e3c7de9a51456bb43fe64263f2906e927 100644
--- a/pages/component/text/text-props.test.js
+++ b/pages/component/text/text-props.test.js
@@ -13,12 +13,25 @@ describe('text-props', () => {
})
it('empty text', async () => {
+ await page.setData({
+ autoTest: true
+ })
const element = await page.$('#empty-text')
if (element != null) {
const { width, height } = await element.size()
expect(width).toBe(0)
expect(height).toBe(0)
}
+ page.callMethod("setTextEmpty")
+ const element2 = await page.$('#empty-text2')
+ if (element2 != null) {
+ const { width, height } = await element2.size()
+ expect(width).toBe(0)
+ expect(height).toBe(0)
+ }
+ await page.setData({
+ autoTest: false
+ })
})
if (process.env.uniTestPlatformInfo.indexOf('web') > -1) {
diff --git a/pages/component/text/text-props.uvue b/pages/component/text/text-props.uvue
index c6093576a1edf5cd2fe7b59772ab250047ac6aae..5bb4403fb196155c67ab1a232e856799aa727832 100644
--- a/pages/component/text/text-props.uvue
+++ b/pages/component/text/text-props.uvue
@@ -96,10 +96,12 @@
hello uni-app x
-
+
-
+
+ test
+
@@ -112,12 +114,17 @@ export default {
multiLineText:
'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言',
singleLineText: 'uni-app x,终极跨平台方案',
+ // 自动化测试
+ autoTest: false
}
},
methods: {
// 自动化测试
setTextNested() {
- (this.$refs["text-nested"] as UniTextElement).value = "二级节点文字红色且背景色黄色";
+ (this.$refs["text-nested"] as UniElement).setAttribute("value", "二级节点文字红色且背景色黄色");
+ },
+ setTextEmpty() {
+ (this.$refs["empty-text2"] as UniElement).setAttribute("value", "");
}
}
}