mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-24 04:49:23 +01:00
* init modernization * implement esbuild * Make first build work * Fix esbuild for lucide-react * Add vitest for lucide-react * add esbuild lucide and lucide-react * update package lock * implement preact * Add typescript and vitest * adjust workflows * Fix mocking react-native package * update lock file * Add esbuild in svelte * make svelte test work in vitest * Refactor lucide svelte * Transform lucide vue to typescript * Finish lucide-vue-next typescript * 0.104.0-beta.0 * remove version in main package.json * cleanup * Fix svelte tests snapshots * clean up * add rollup lucide-vue-next * Fix lucide svelte package * change to workspace link * revert filter position * revert preact workflow change * cleanup * Fix some types * add semi
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
import { render } from '@testing-library/react'
|
|
import { Grid } from '../src/icons'
|
|
|
|
vi.mock('react-native-svg')
|
|
|
|
type Attributes = Record<string, { value: unknown}>
|
|
|
|
describe('Using lucide icon components', () => {
|
|
it('should render an component', () => {
|
|
const { container } = render(<Grid /> );
|
|
|
|
expect( container.innerHTML ).toMatchSnapshot();
|
|
});
|
|
|
|
it('should adjust the size, stroke color and stroke width', () => {
|
|
const testId = 'grid-icon';
|
|
const { container, getByTestId } = render(
|
|
<Grid
|
|
data-testid={testId}
|
|
size={48}
|
|
stroke="red"
|
|
strokeWidth={4}
|
|
/>,
|
|
);
|
|
|
|
const { attributes } = getByTestId(testId);
|
|
expect((attributes as unknown as Attributes).stroke.value).toBe('red');
|
|
expect((attributes as unknown as Attributes).width.value).toBe('48');
|
|
expect((attributes as unknown as Attributes).height.value).toBe('48');
|
|
expect((attributes as unknown as Attributes)['stroke-width'].value).toBe('4');
|
|
|
|
expect( container.innerHTML ).toMatchSnapshot();
|
|
});
|
|
})
|