2020-08-04 11:45:50 +08:00
|
|
|
import { mount } from '@vue/test-utils'
|
2020-08-05 23:30:12 +08:00
|
|
|
import Radio from '../src/radio.vue'
|
2020-08-04 11:45:50 +08:00
|
|
|
|
2020-08-05 23:30:12 +08:00
|
|
|
describe('Radio', () => {
|
|
|
|
test('create', async () => {
|
|
|
|
const TestComponent = {
|
|
|
|
template: `<el-radio v-model="radio" label="a">
|
|
|
|
</el-radio>`,
|
|
|
|
components: {
|
|
|
|
'el-radio': Radio,
|
2020-08-04 11:45:50 +08:00
|
|
|
},
|
2020-08-05 23:30:12 +08:00
|
|
|
data: () => ({ radio: '' }),
|
|
|
|
}
|
|
|
|
const wrapper = mount(TestComponent)
|
|
|
|
expect(wrapper.classes()).toContain('el-radio')
|
|
|
|
await wrapper.trigger('click')
|
|
|
|
expect(wrapper.classes()).toContain('is-checked')
|
2020-08-04 11:45:50 +08:00
|
|
|
})
|
|
|
|
})
|