mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-11 13:28:19 +00:00
* fix(vue): support kebab-case icon-node prop on Icon component The Icon component destructured `iconNode` camelCase-only while `stroke-width`/`absolute-stroke-width` accept both cases, so the idiomatic Vue usage `<Icon :icon-node="..." />` left iconNode undefined and crashed with 'Cannot read properties of undefined (reading map)' (#3485). Accept the kebab-case alias and guard the render path. Closes #3485 * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * chore(vue): apply prettier formatting to Icon.ts --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { render } from '@testing-library/vue';
|
|
|
|
import { airVent } from './testIconNodes';
|
|
import { Icon } from '../src/lucide-vue';
|
|
|
|
describe('Using Icon Component', () => {
|
|
it('should render icon based on a iconNode', async () => {
|
|
const { container } = render(Icon, {
|
|
props: {
|
|
iconNode: airVent,
|
|
name: 'AirVent',
|
|
size: 48,
|
|
color: 'red',
|
|
absoluteStrokeWidth: true,
|
|
},
|
|
});
|
|
|
|
expect(container.firstChild).toBeDefined();
|
|
});
|
|
|
|
it('should render when iconNode is passed as the kebab-case icon-node prop', async () => {
|
|
const { container } = render(Icon, {
|
|
props: {
|
|
'icon-node': airVent,
|
|
name: 'AirVent',
|
|
},
|
|
});
|
|
|
|
expect(container.firstChild).toBeDefined();
|
|
expect(container.querySelector('svg')).toBeTruthy();
|
|
});
|
|
|
|
it('should render icon and match snapshot', async () => {
|
|
const { container } = render(Icon, {
|
|
props: {
|
|
iconNode: airVent,
|
|
name: 'AirVent',
|
|
size: 48,
|
|
color: 'red',
|
|
absoluteStrokeWidth: true,
|
|
},
|
|
});
|
|
|
|
expect(container.firstChild).toMatchSnapshot();
|
|
});
|
|
});
|