test(Skeleton): cover Skeleton with tests
This commit is contained in:
24
src/shared/ui/Skeleton/Skeleton.svelte.test.ts
Normal file
24
src/shared/ui/Skeleton/Skeleton.svelte.test.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { render } from '@testing-library/svelte';
|
||||
import Skeleton from './Skeleton.svelte';
|
||||
|
||||
describe('Skeleton', () => {
|
||||
it('renders a div element', () => {
|
||||
const { container } = render(Skeleton);
|
||||
expect(container.querySelector('div')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('animates by default', () => {
|
||||
const { container } = render(Skeleton);
|
||||
expect(container.querySelector('div')).toHaveClass('animate-pulse');
|
||||
});
|
||||
|
||||
it('disables animation when animate=false', () => {
|
||||
const { container } = render(Skeleton, { animate: false });
|
||||
expect(container.querySelector('div')).not.toHaveClass('animate-pulse');
|
||||
});
|
||||
|
||||
it('passes additional class', () => {
|
||||
const { container } = render(Skeleton, { class: 'w-24 h-4' });
|
||||
expect(container.querySelector('div')).toHaveClass('w-24', 'h-4');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user