mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
test(radio): added some tests (#1022)
This commit is contained in:
parent
5e219eb8c6
commit
1ef0dc71b3
@ -13,6 +13,14 @@ describe('n-radio', () => {
|
||||
expect(wrapper.find('.n-radio').classes()).toContain('n-radio--checked')
|
||||
})
|
||||
|
||||
it('should work with `defaultChecked` prop', async () => {
|
||||
let wrapper = mount(NRadio, { props: { defaultChecked: true } })
|
||||
expect(wrapper.find('.n-radio').classes()).toContain('n-radio--checked')
|
||||
|
||||
wrapper = mount(NRadio, { props: { defaultChecked: false } })
|
||||
expect(wrapper.find('.n-radio').classes()).not.toContain('n-radio--checked')
|
||||
})
|
||||
|
||||
it('should work with `disabled` prop', async () => {
|
||||
const wrapper = mount(NRadio, { props: { disabled: false } })
|
||||
expect(wrapper.find('.n-radio').classes()).not.toContain(
|
||||
@ -22,6 +30,18 @@ describe('n-radio', () => {
|
||||
expect(wrapper.find('.n-radio').classes()).toContain('n-radio--disabled')
|
||||
})
|
||||
|
||||
it('should work with `name` prop', async () => {
|
||||
const wrapper = mount(NRadio, { props: { name: 'randomName111' } })
|
||||
|
||||
const radio = wrapper.find('input[type=radio')
|
||||
|
||||
expect(radio.attributes('name')).toEqual('randomName111')
|
||||
|
||||
await wrapper.setProps({ name: 'randomName222' })
|
||||
|
||||
expect(radio.attributes('name')).toEqual('randomName222')
|
||||
})
|
||||
|
||||
it('should work with `size` prop', async () => {
|
||||
const wrapper = mount(NRadio, { props: { size: 'small' } })
|
||||
expect(wrapper.find('.n-radio').attributes('style')).toMatchSnapshot()
|
||||
|
Loading…
Reference in New Issue
Block a user