n-link/n-link-core/components/Icon.spec.ts
Your Name 25fddd2afe feat(ui): add inline Icon component for themeable feather icons
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 19:03:59 -04:00

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/);
});
});