Fix: complete unit test for radio-button (#173)

This commit is contained in:
HelenYin 2020-08-21 17:40:20 +08:00 committed by GitHub
parent e2754a06cd
commit b7f090da8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,11 +290,20 @@ describe('Radio Button', () => {
}))
const radio1 = wrapper.findComponent({ ref: 'radio1' })
const radio2 = wrapper.findComponent({ ref: 'radio2' })
const radio3 = wrapper.findComponent({ ref: 'radio3' })
const vm = wrapper.vm as any
expect(vm.radio).toEqual(6)
radio2.trigger('keydown.left')
expect(vm.radio).toEqual(3)
radio1.trigger('keydown.left')
expect(vm.radio).toEqual(9)
await nextTick()
radio3.trigger('keydown.right')
expect(vm.radio).toEqual(3)
radio1.trigger('keydown.right')
expect(vm.radio).toEqual(6)
await nextTick()
radio1.trigger('keydown.enter')
expect(vm.radio).toEqual(6)
})
})