From 8f098f28f0ec6fc2f55e4c634f3676a18cb4bf92 Mon Sep 17 00:00:00 2001 From: jixinbao Date: Fri, 31 May 2024 10:58:05 +0800 Subject: [PATCH] =?UTF-8?q?test:=20radio=20=E7=BB=84=E4=BB=B6=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E7=9B=B8=E5=85=B3=20log=20=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/radio/radio.test.js | 2 ++ pages/component/radio/radio.uvue | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pages/component/radio/radio.test.js b/pages/component/radio/radio.test.js index baa7ec15..494cdbc6 100644 --- a/pages/component/radio/radio.test.js +++ b/pages/component/radio/radio.test.js @@ -73,6 +73,8 @@ describe('Radio.uvue', () => { it('trigger UniRadioGroupChangeEvent', async () => { const element = await page.$('#trigger-change') await element.tap() + console.log('radio trigger change event', element) + await page.waitFor(1000) const eventCallbackNum = await page.callMethod('getEventCallbackNum') expect(eventCallbackNum - originEventCallbackNum).toBe(3) }) diff --git a/pages/component/radio/radio.uvue b/pages/component/radio/radio.uvue index abbb73bd..2d04b7d6 100644 --- a/pages/component/radio/radio.uvue +++ b/pages/component/radio/radio.uvue @@ -52,7 +52,8 @@ activeBorderColor_input: "", iconColor_input: "#ffffff" } - }, + }, + methods: { radioChange(e : UniRadioGroupChangeEvent) { const selected = this.items.find((item) : boolean => { @@ -72,8 +73,9 @@ setEventCallbackNum(num) }, testChange(e : UniRadioGroupChangeEvent) { - // 自动化测试 - if ((e.target?.tagName ?? '').includes('RADIO-GROUP')) { + // 自动化测试 + console.log('test: radio event detail', e.target?.tagName, e.type) + if ((e.target?.tagName ?? '') == 'RADIO-GROUP') { this.setEventCallbackNum(state.eventCallbackNum + 1) } if (e.type === 'change') { -- GitLab