From a9b41a60cc367ac75eb723189206d6aadd3f1c67 Mon Sep 17 00:00:00 2001 From: jixinbao Date: Fri, 31 May 2024 13:04:21 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=A1=A5=E5=85=85=20checkbox=20iconCol?= =?UTF-8?q?or/foreColor=20=E7=9B=B8=E5=85=B3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/checkbox/checkbox.test.js | 19 ++++++++++++++- pages/component/checkbox/checkbox.uvue | 29 ++++++++++++++--------- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/pages/component/checkbox/checkbox.test.js b/pages/component/checkbox/checkbox.test.js index 6a4ff401..20083b7d 100644 --- a/pages/component/checkbox/checkbox.test.js +++ b/pages/component/checkbox/checkbox.test.js @@ -67,6 +67,23 @@ describe('Checkbox.uvue', () => { }) expect(await cb.attribute('color')).toBe('#63acfc') }) + + it('icon color', async () => { + const cb = await page.$('.cb') + expect(await cb.attribute('iconColor')).toBe('#211cfe') + await page.setData({ + iconColor: '#63acfc', + }) + expect(await cb.attribute('iconColor')).toBe('#63acfc') + }) + it('foreColor', async () => { + const cb = await page.$('.cb') + expect(await cb.attribute('foreColor')).toBe('#ff0000') + await page.setData({ + foreColor: '#63acfe', + }) + expect(await cb.attribute('foreColor')).toBe('#63acfe') + }) it('disabled', async () => { const cb = await page.$('.cb2') expect(await cb.attribute('disabled')).toBe(true + '') @@ -78,7 +95,7 @@ describe('Checkbox.uvue', () => { it('trigger UniCheckboxGroupChangeEvent', async () => { const element = await page.$('.checkbox-item-0') await element.tap() - await page.waitFor(500) + await page.waitFor(1000) const eventCallbackNum = await page.callMethod('getEventCallbackNum') expect(eventCallbackNum - originEventCallbackNum).toBe(3) }) diff --git a/pages/component/checkbox/checkbox.uvue b/pages/component/checkbox/checkbox.uvue index c409c87f..bae7e76a 100644 --- a/pages/component/checkbox/checkbox.uvue +++ b/pages/component/checkbox/checkbox.uvue @@ -46,7 +46,9 @@ value: [] as string[], disabled: true, checked: true, - color: '#007aff', + color: '#007aff', + iconColor:'#211cfe', + foreColor:'#ff0000', // 组件属性 autotest checked_boolean: false, disabled_boolean: false, @@ -55,7 +57,8 @@ borderColor_input: "#d1d1d1", activeBackgroundColor_input: "#ffffff", activeBorderColor_input: "#d1d1d1", - iconColor_input: "#007aff" + iconColor_input: "#007aff", + foreColor_input: '#ff0000' } }, methods: { @@ -70,7 +73,7 @@ }, checkboxChange: function (e : UniCheckboxGroupChangeEvent) { // 自动化测试 - if ((e.target?.tagName ?? '').includes('CHECKBOX-GROUP')) { + if ((e.target?.tagName ?? '') == 'CHECKBOX-GROUP') { this.setEventCallbackNum(state.eventCallbackNum + 1) } if (e.type === 'change') { @@ -105,19 +108,20 @@ confirm_borderColor_input(value : string) { this.borderColor_input = value }, confirm_activeBackgroundColor_input(value : string) { this.activeBackgroundColor_input = value }, confirm_activeBorderColor_input(value : string) { this.activeBorderColor_input = value }, - confirm_iconColor_input(value : string) { this.iconColor_input = value } + confirm_iconColor_input(value : string) { this.iconColor_input = value }, + confirm_foreColor_input(value : string) { this.foreColor_input = value } } }