From 91eee44f52579d0d23621a5ca617aaf0170c0227 Mon Sep 17 00:00:00 2001 From: hdx Date: Thu, 30 May 2024 18:34:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(switch):=20=E5=A2=9E=E5=8A=A0=E6=96=B0?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/switch/switch.test.js | 10 ++++++++++ pages/component/switch/switch.uvue | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pages/component/switch/switch.test.js b/pages/component/switch/switch.test.js index a3400d0a..79ccc75f 100644 --- a/pages/component/switch/switch.test.js +++ b/pages/component/switch/switch.test.js @@ -37,6 +37,16 @@ describe('switch', () => { await page.waitFor(100) expect(await switch_element.attribute('color')).toBe(color) }) + it('dark', async () => { + const dark = await page.$('#dark') + const darkChecked = await page.$('#darkChecked') + + expect(await dark.attribute('background-color')).toBe('#1f1f1f') + expect(await dark.attribute('fore-color')).toBe('#f0f0f0') + + expect(await darkChecked.attribute('active-background-color')).toBe('#007aff') + expect(await darkChecked.attribute('active-fore-color')).toBe('#ffffff') + }) it('click', async () => { let switchElement // TODO 暂时通过获取组件内部的 class 触发模拟点击 diff --git a/pages/component/switch/switch.uvue b/pages/component/switch/switch.uvue index 650dac0f..3f2acf2b 100644 --- a/pages/component/switch/switch.uvue +++ b/pages/component/switch/switch.uvue @@ -5,7 +5,11 @@ - + + 暗黑样式 + + + 禁用样式 -- GitLab