diff --git a/packages/vue/src/createLucideIcon.ts b/packages/vue/src/createLucideIcon.ts index ec5386c35..85919b106 100644 --- a/packages/vue/src/createLucideIcon.ts +++ b/packages/vue/src/createLucideIcon.ts @@ -19,7 +19,7 @@ const createLucideIcon = iconNode, name: iconName, }, - slots, + slots.default ? { default: slots.default } : undefined, ); export default createLucideIcon; diff --git a/packages/vue/tests/lucide-vue.spec.ts b/packages/vue/tests/lucide-vue.spec.ts index 61f3b330b..bde2e0fd5 100644 --- a/packages/vue/tests/lucide-vue.spec.ts +++ b/packages/vue/tests/lucide-vue.spec.ts @@ -1,6 +1,7 @@ import { describe, it, expect, vi, afterEach } from 'vitest'; import { render, fireEvent, cleanup } from '@testing-library/vue'; import { Smile, Edit2, Pen } from '../src/lucide-vue'; +import createLucideIcon from '../src/createLucideIcon'; import defaultAttributes from '../src/defaultAttributes'; describe('Using lucide icon components', () => { @@ -108,6 +109,25 @@ describe('Using lucide icon components', () => { expect(container).toMatchSnapshot(); }); + it('should handle non-extensible slots objects', () => { + const Icon = createLucideIcon('test-icon', [['path', { d: 'M0 0h1', key: 'test-key' }]]); + const slots = Object.freeze({ + default: () => 'Hello World', + }); + + expect(() => + Icon( + {}, + { + attrs: {}, + emit: vi.fn(), + expose: vi.fn(), + slots, + }, + ), + ).not.toThrow(); + }); + it('should render the alias icon', () => { const { container } = render(Pen, { props: {