mirror of
https://github.com/lights0123/n-link.git
synced 2026-08-07 18:23:28 +00:00
23 lines
799 B
TypeScript
23 lines
799 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { mount } from '@vue/test-utils';
|
|
import Icon from './Icon.vue';
|
|
|
|
describe('Icon', () => {
|
|
it('renders an inline svg that inherits currentColor', () => {
|
|
const wrapper = mount(Icon, { props: { name: 'refresh-cw' } });
|
|
expect(wrapper.html()).toContain('<svg');
|
|
expect(wrapper.html()).toContain('currentColor');
|
|
});
|
|
|
|
it('applies the size to width and height', () => {
|
|
const wrapper = mount(Icon, { props: { name: 'chevron-right', size: 32 } });
|
|
expect(wrapper.html()).toContain('width="32"');
|
|
expect(wrapper.html()).toContain('height="32"');
|
|
});
|
|
|
|
it('throws for an unknown icon name', () => {
|
|
expect(() => mount(Icon, { props: { name: 'not-a-real-icon' } }))
|
|
.toThrow(/unknown feather icon/);
|
|
});
|
|
});
|