From 67a9abbcf4b33fca471c1d5022b168816f94f86a Mon Sep 17 00:00:00 2001 From: XHY Date: Tue, 20 Aug 2024 16:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20rich-text.test=20=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E6=B5=8B=E8=AF=95=E5=8A=A8=E6=80=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=86=85=E5=AE=B9=E7=BB=84=E4=BB=B6=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/rich-text/rich-text.test.js | 32 +++++++++++++++++ pages/component/rich-text/rich-text.uvue | 38 +++++++++++++++++++-- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 pages/component/rich-text/rich-text.test.js diff --git a/pages/component/rich-text/rich-text.test.js b/pages/component/rich-text/rich-text.test.js new file mode 100644 index 00000000..a5144416 --- /dev/null +++ b/pages/component/rich-text/rich-text.test.js @@ -0,0 +1,32 @@ +const PAGE_PATH = '/pages/component/rich-text/rich-text' + +describe('rich-text-test', () => { + + // 先屏蔽 android 及 web 平台 + if (process.env.uniTestPlatformInfo.startsWith('android') || process.env.uniTestPlatformInfo.startsWith('web')) { + it('other platform', () => { + expect(1).toBe(1) + }) + return + } + + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(1000); + }) + + + it('richt-text-height', async () => { + let beforeValue = await page.data('richTextHeight') + await page.callMethod('changeText') + await page.waitFor(500) + await page.callMethod('changeText') + await page.waitFor(500) + let afterValue = await page.data('richTextHeight') + console.log('beforeValue:', beforeValue) + console.log('afterValue:', afterValue) + expect(beforeValue).toBe(afterValue) + }) + +}) diff --git a/pages/component/rich-text/rich-text.uvue b/pages/component/rich-text/rich-text.uvue index 6155e080..0744c1b5 100644 --- a/pages/component/rich-text/rich-text.uvue +++ b/pages/component/rich-text/rich-text.uvue @@ -16,14 +16,48 @@ selectable - +