天波用户运营管理后台系统
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SvgIcon.spec.js 621B

3 年前
12345678910111213141516171819202122
  1. import { shallowMount } from '@vue/test-utils'
  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. })