mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-15 14:08:49 +00:00
* Add Lucide React integration tests * Apply batched suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Remove redundant icon comparison test Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * test(lucide-react): fix browser locator markup assertions --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
39 lines
1.9 KiB
TypeScript
39 lines
1.9 KiB
TypeScript
import { expect, test } from 'vitest';
|
|
import { render } from 'vitest-browser-react';
|
|
import IconShowcase from '../src/IconShowcase';
|
|
|
|
test('renders Lucide public APIs in a real browser', async () => {
|
|
const screen = await render(<IconShowcase />);
|
|
|
|
const staticIcon = screen.getByTestId('static-icon');
|
|
await expect.element(staticIcon).toBeVisible();
|
|
await expect.element(staticIcon).toHaveAttribute('width', '24');
|
|
await expect.element(staticIcon).toHaveAttribute('height', '24');
|
|
await expect.element(staticIcon).toHaveAttribute('viewBox', '0 0 24 24');
|
|
await expect.element(staticIcon).toHaveAttribute('aria-hidden', 'true');
|
|
|
|
const customIcon = screen.getByTestId('custom-icon');
|
|
await expect.element(customIcon).toBeVisible();
|
|
await expect.element(customIcon).toHaveAttribute('width', '48');
|
|
await expect.element(customIcon).toHaveAttribute('height', '48');
|
|
await expect.element(customIcon).toHaveAttribute('stroke', 'red');
|
|
await expect.element(customIcon).toHaveAttribute('stroke-width', '2');
|
|
await expect.element(customIcon).toHaveClass('consumer-icon');
|
|
|
|
const providerIcon = screen.getByTestId('provider-icon');
|
|
await expect.element(providerIcon).toHaveAttribute('width', '32');
|
|
await expect.element(providerIcon).toHaveAttribute('stroke', 'purple');
|
|
await expect.element(providerIcon).toHaveAttribute('stroke-width', '3');
|
|
|
|
const aliasIcon = screen.getByTestId('alias-icon');
|
|
const canonicalIcon = screen.getByTestId('canonical-icon');
|
|
await expect.element(aliasIcon).toBeVisible();
|
|
await expect.element(canonicalIcon).toBeVisible();
|
|
expect(aliasIcon.element().innerHTML).toBe(canonicalIcon.element().innerHTML);
|
|
|
|
const dynamicIcon = screen.getByTestId('dynamic-icon');
|
|
await expect.element(dynamicIcon).toBeVisible();
|
|
await expect.element(dynamicIcon).toHaveAttribute('aria-label', 'Dynamic circle');
|
|
await expect.element(dynamicIcon).not.toHaveAttribute('aria-hidden');
|
|
});
|