ibps-icon.spec.js 753 B

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