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

fix(component): test

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