From 505690a65c01c5deccb6180e5dec4f0843a0c423 Mon Sep 17 00:00:00 2001 From: shutao Date: Sat, 9 Mar 2024 17:58:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85checkUniButtonElement?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/button/button.test.js | 5 +++++ pages/component/button/button.uvue | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pages/component/button/button.test.js b/pages/component/button/button.test.js index ab21e798..982186fb 100644 --- a/pages/component/button/button.test.js +++ b/pages/component/button/button.test.js @@ -76,5 +76,10 @@ describe('Button.uvue', () => { }) const newValue2 = await btn.property('disabled') expect(newValue2.toString()).toBe(true + '') + }) + + it(checkUniButtonElement, async () => { + const value = await page.callMethod('checkUniButtonElement') + expect(value).toBe(true) }) }) diff --git a/pages/component/button/button.uvue b/pages/component/button/button.uvue index ec3646c9..7a000f30 100644 --- a/pages/component/button/button.uvue +++ b/pages/component/button/button.uvue @@ -35,14 +35,22 @@ uni.navigateTo({ url: 'buttonstatus', }) - }, + }, + //用于自动化测试 + checkUniButtonElement(): boolean { + const button = uni.getElementById("testButton") + if(button != null && button instanceof UniButtonElement) { + return true + } + return false + } } }