d2-icon.spec.js 737 B

12345678910111213141516171819202122232425262728293031
  1. import { mount } from '@vue/test-utils'
  2. import D2Icon from '@/components/d2-icon/index.vue'
  3. describe('d2-icon', () => {
  4. // 存在且是Vue组件实例
  5. it('is a vue instance', () => {
  6. const wrapper = mount(D2Icon)
  7. expect(wrapper.exists()).toBeTruthy()
  8. expect(wrapper.isVueInstance()).toBeTruthy()
  9. })
  10. // 包含特定类名
  11. it('contains specific classnames', () => {
  12. const wrapper = mount(D2Icon)
  13. expect(wrapper.is('.fa')).toBeTruthy()
  14. expect(wrapper.contains('.fa-font-awesome')).toBeTruthy()
  15. })
  16. // props
  17. it('has props', () => {
  18. const wrapper = mount(D2Icon, {
  19. propsData: {
  20. name: 'font-awesome'
  21. }
  22. })
  23. expect(wrapper.props().name).toEqual('font-awesome')
  24. })
  25. })