long
2021-08-18 08bd89345399c05df87ad065918494837b9d57bb
提交 | 用户 | age
2a61f6 1 import { shallowMount } from '@vue/test-utils'
L 2 import SvgIcon from '@/components/SvgIcon/index.vue'
3 describe('SvgIcon.vue', () => {
4   it('iconClass', () => {
5     const wrapper = shallowMount(SvgIcon, {
6       propsData: {
7         iconClass: 'test'
8       }
9     })
10     expect(wrapper.find('use').attributes().href).toBe('#icon-test')
11   })
12   it('className', () => {
13     const wrapper = shallowMount(SvgIcon, {
14       propsData: {
15         iconClass: 'test'
16       }
17     })
18     expect(wrapper.classes().length).toBe(1)
19     wrapper.setProps({ className: 'test' })
20     expect(wrapper.classes().includes('test')).toBe(true)
21   })
22 })