import { describe, it, expect } from 'vitest'; import { render, screen } from '@testing-library/react'; import { Skeleton } from './skeleton'; describe('Skeleton', () => { it('should render skeleton', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toBeInTheDocument(); expect(skeleton).toHaveAttribute('aria-label', 'Chargement...'); }); it('should render with default rectangular variant', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveClass('rounded'); }); it('should render with circular variant', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveClass('rounded-full'); }); it('should render with text variant', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveClass('rounded'); }); it('should render with pulse animation by default', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveClass('animate-pulse'); }); it('should render with wave animation', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveClass('shimmer'); }); it('should render without animation', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).not.toHaveClass('animate-pulse'); expect(skeleton).not.toHaveClass('shimmer'); }); it('should apply custom width', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveStyle({ width: '200px' }); }); it('should apply custom height', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveStyle({ height: '100px' }); }); it('should apply numeric width and height', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveStyle({ width: '300px', height: '150px' }); }); it('should apply custom className', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveClass('custom-class'); }); it('should have accessibility attributes', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveAttribute('aria-label', 'Chargement...'); const srOnly = screen.getByText('Chargement...'); expect(srOnly).toHaveClass('sr-only'); }); it('should have dark mode support', () => { render(); const skeleton = screen.getByRole('status'); expect(skeleton).toHaveClass('dark:bg-gray-700'); }); });