index.spec.js 788 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Icon from '..';
  2. import { mount } from '../../../test/utils';
  3. test('render icon with builtin icon name', () => {
  4. const wrapper = mount(Icon, {
  5. propsData: {
  6. name: 'success'
  7. }
  8. });
  9. expect(wrapper).toMatchSnapshot();
  10. });
  11. test('render icon with url name', () => {
  12. const wrapper = mount(Icon, {
  13. propsData: {
  14. name: 'https://img.yzcdn.com/icon.jpg'
  15. }
  16. });
  17. expect(wrapper).toMatchSnapshot();
  18. });
  19. test('render icon default slot', () => {
  20. const wrapper = mount({
  21. render(h) {
  22. return h(Icon, { props: { name: 'success' } }, ['Default slot']);
  23. }
  24. });
  25. expect(wrapper).toMatchSnapshot();
  26. });
  27. test('tag prop', () => {
  28. const wrapper = mount(Icon, {
  29. propsData: {
  30. tag: 'div'
  31. }
  32. });
  33. expect(wrapper).toMatchSnapshot();
  34. });