Skip to main content
Glama
deleonio
by deleonio
snapshot.test.tsx1.74 kB
import { h } from '@stencil/core'; import { renderFunctionalComponentToSpecPage } from '../../../utils/testing'; import type { IconButtonProps } from '../IconButton'; import KolIconButtonFc from '../IconButton'; describe('KolIconButtonFc', () => { it('should render button component correctly', async () => { const props: IconButtonProps = { componentName: 'button', label: 'Test Button', icon: 'test-icon' }; const page = await renderFunctionalComponentToSpecPage(() => <KolIconButtonFc {...props} />); expect(page.root).toMatchSnapshot(); expect(page.root?.tagName).toBe('KOL-BUTTON-WC'); expect(page.root?.getAttribute('_label')).toContain('Test Button'); }); it('should render icon component correctly', async () => { const props: IconButtonProps = { componentName: 'icon', icon: 'test-icon' }; const page = await renderFunctionalComponentToSpecPage(() => <KolIconButtonFc {...props} />); expect(page.root).toMatchSnapshot(); expect(page.root?.tagName).toBe('KOL-ICON'); }); it('should handle onClick event', async () => { const onClick = jest.fn(); const props: IconButtonProps = { componentName: 'button', label: 'Test Button', icon: 'test-icon', onClick }; const page = await renderFunctionalComponentToSpecPage(() => <KolIconButtonFc {...props} />); expect(page.root?.getAttribute('onClick')).toBeDefined(); }); it('should render with additional props', async () => { const props: IconButtonProps = { componentName: 'button', label: 'Test Button', icon: 'test-icon', class: 'custom-class' }; const page = await renderFunctionalComponentToSpecPage(() => <KolIconButtonFc {...props} />); expect(page.root).toMatchSnapshot(); expect(page.root?.className).toContain('custom-class'); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server