提交 d64bbdc3 编写于 作者: H hdx 提交者: 雪洛

feat(switch): 增加新属性测试

上级 ee38f9b7
...@@ -37,6 +37,16 @@ describe('switch', () => { ...@@ -37,6 +37,16 @@ describe('switch', () => {
await page.waitFor(100) await page.waitFor(100)
expect(await switch_element.attribute('color')).toBe(color) 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 () => { it('click', async () => {
let switchElement let switchElement
// TODO 暂时通过获取组件内部的 class 触发模拟点击 // TODO 暂时通过获取组件内部的 class 触发模拟点击
......
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
<view class="flex-row"> <view class="flex-row">
<switch class="switch-checked" :checked="checked" @change="switch1Change" /> <switch class="switch-checked" :checked="checked" @change="switch1Change" />
<switch @change="switch2Change" /> <switch @change="switch2Change" />
<!-- <text class="switch-checked-value">{{clickCheckedValue}}</text> --> </view>
<view class="uni-title">暗黑样式</view>
<view class="flex-row">
<switch id="darkChecked" background-color="#1f1f1f" activeBackgroundColor="#007aff" foreColor="#f0f0f0" activeForeColor="#ffffff" :checked="checked" />
<switch id="dark" background-color="#1f1f1f" activeBackgroundColor="#007aff" foreColor="#f0f0f0" activeForeColor="#ffffff" />
</view> </view>
<view class="uni-title">禁用样式</view> <view class="uni-title">禁用样式</view>
<view class="flex-row"> <view class="flex-row">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册