提交 730a269e 编写于 作者: Y yurj26

fix(component): test

上级 23f469e5
......@@ -22,8 +22,8 @@ describe('Button.uvue', () => {
expect(await getData('count')).toEqual(1)
})
it('length', async () => {
const btnLen = await page.$$('.button')
expect(btnLen.length).toBe(13)
const elements = await page.$$('.button')
expect(elements.length).toBe(13)
})
it('text', async () => {
const textBtn = await page.$('.text-button')
......
......@@ -23,6 +23,8 @@ describe('Checkbox.uvue', () => {
expect(await getData('value')).toEqual(["cb1"])
await cb2.tap()
expect(await getData('value')).toEqual(["cb1"])
await cb1.tap()
expect(await getData('value')).toEqual([])
})
it('length', async () => {
const checkboxGroupElements = await page.$$('.checkbox-group')
......@@ -31,12 +33,12 @@ describe('Checkbox.uvue', () => {
expect(checkboxElements.length).toBe(11)
})
it('text', async () => {
const cb = await page.$('.cb')
expect(await cb.text()).toEqual('选中')
const cb = await page.$('.cb1')
expect(await cb.text()).toEqual('选中')
await page.setData({
text: 'checked'
text: 'not selected'
})
expect(await cb.text()).toEqual('checked')
expect(await cb.text()).toEqual('not selected')
})
it('checked', async () => {
const cb = await page.$('.cb')
......
......@@ -10,8 +10,8 @@
<view>
<checkbox-group class="uni-flex uni-row checkbox-group" @change="testChange">
<checkbox value="cb" :checked="checked" :color="color" style="margin-right: 30rpx;"
class="checkbox cb">{{text}}</checkbox>
<checkbox value="cb1" style="margin-right: 30rpx;" class="checkbox cb1">未选中</checkbox>
class="checkbox cb">选中</checkbox>
<checkbox value="cb1" style="margin-right: 30rpx;" class="checkbox cb1">{{text}}</checkbox>
<checkbox value="cb2" :disabled="disabled" class="checkbox cb2">禁用</checkbox>
</checkbox-group>
</view>
......@@ -93,7 +93,7 @@
}
] as ItemType[],
text: '选中',
text: '选中',
value: [] as string[],
disabled: true,
checked: true,
......
......@@ -31,12 +31,12 @@ describe('Radio.uvue', () => {
expect(radioElements.length).toBe(11)
})
it('text', async () => {
const radio = await page.$('.r')
expect(await radio.text()).toEqual('选中')
const radio = await page.$('.r1')
expect(await radio.text()).toEqual('选中')
await page.setData({
text: 'checked'
text: 'not selected'
})
expect(await radio.text()).toEqual('checked')
expect(await radio.text()).toEqual('not selected')
})
it('checked', async () => {
const radio = await page.$('.r')
......
......@@ -8,9 +8,9 @@
</text>
</view>
<radio-group class="uni-flex uni-row radio-group" @change="testChange">
<radio value="r" :checked="checked" :color="color" style="margin-right: 30rpx;" class="radio r">{{text}}
<radio value="r" :checked="checked" :color="color" style="margin-right: 30rpx;" class="radio r">选中
</radio>
<radio value="r1" style="margin-right: 30rpx;" class="radio r1">未选中</radio>
<radio value="r1" style="margin-right: 30rpx;" class="radio r1">{{text}}</radio>
<radio value="r2" :disabled="disabled" class="radio r2">禁用</radio>
</radio-group>
</view>
......@@ -82,7 +82,7 @@
current: 0,
value: '',
text: '选中',
text: '选中',
disabled: true,
checked: true,
color: '#007aff'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册