25 lines
873 B
TypeScript
25 lines
873 B
TypeScript
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');
|
|
});
|
|
});
|