From bf22549a0d4ccad9a9ab50c6d510cd94332d78c0 Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Fri, 15 Mar 2024 12:43:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0text=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E5=92=8C=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/text/text-props.test.js | 25 ++++++++++++++++++++----- pages/component/text/text-props.uvue | 21 +++++++++++++-------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/pages/component/text/text-props.test.js b/pages/component/text/text-props.test.js index 7956e946..0b41c2c2 100644 --- a/pages/component/text/text-props.test.js +++ b/pages/component/text/text-props.test.js @@ -22,7 +22,7 @@ describe('text-props', () => { expect(width).toBe(0) expect(height).toBe(0) } - await page.callMethod("setTextEmpty") + await page.callMethod("setEmptyText") await page.waitFor(100) const element2 = await page.$('#empty-text2') if (element2 != null) { @@ -35,15 +35,30 @@ describe('text-props', () => { }) }) - it('text nested', async () => { + it('nested text', async () => { await page.setData({ autoTest: true }) - await page.callMethod("setTextNested") + await page.callMethod("setNestedText") await page.waitFor(100) - const element = await page.$('#text-nested') + const element = await page.$('#nested-text') if (element != null) { - expect(await element.text()).toBe("修改三级节点") + expect(await element.text()).toBe("修改三级节点文本") + } + await page.setData({ + autoTest: false + }) + }) + + it('height text', async () => { + await page.setData({ + autoTest: true + }) + await page.callMethod("setHeightText") + await page.waitFor(100) + const element = await page.$('#height-text') + if (element != null) { + expect(await element.text()).toBe("修改设置高度文本") } await page.setData({ autoTest: false diff --git a/pages/component/text/text-props.uvue b/pages/component/text/text-props.uvue index 2caa46dd..5d8c55c7 100644 --- a/pages/component/text/text-props.uvue +++ b/pages/component/text/text-props.uvue @@ -104,12 +104,13 @@ {{emptyText}} 一级节点 + >一级节点文本 二级节点 - {{nestedText}} + >二级节点文本 + {{nestedText}} + {{heightText}} @@ -125,17 +126,21 @@ export default { singleLineText: 'uni-app x,终极跨平台方案', // 自动化测试 autoTest: false, - nestedText: '三级节点', - emptyText: 'empty' + nestedText: '三级节点文本', + emptyText: '空文本', + heightText: '设置高度文本' } }, methods: { // 自动化测试 - setTextNested() { - this.nestedText = "修改三级节点"; + setNestedText() { + this.nestedText = "修改三级节点文本"; }, - setTextEmpty() { + setEmptyText() { this.emptyText = ""; + }, + setHeightText() { + this.heightText = "修改设置高度文本"; } } } -- GitLab