mirror of
https://github.com/sstent/AICyclingCoach.git
synced 2026-02-14 19:32:25 +00:00
26 lines
923 B
JavaScript
26 lines
923 B
JavaScript
import { render, screen } from '@testing-library/react';
|
|
import LoadingSpinner from '../LoadingSpinner';
|
|
|
|
describe('LoadingSpinner Component', () => {
|
|
test('renders spinner with animation', () => {
|
|
render(<LoadingSpinner />);
|
|
|
|
// Check for the spinner container
|
|
const spinnerContainer = screen.getByRole('status');
|
|
expect(spinnerContainer).toBeInTheDocument();
|
|
|
|
// Verify animation classes
|
|
const spinnerElement = screen.getByTestId('loading-spinner');
|
|
expect(spinnerElement).toHaveClass('animate-spin');
|
|
expect(spinnerElement).toHaveClass('rounded-full');
|
|
|
|
// Check accessibility attributes
|
|
expect(spinnerElement).toHaveAttribute('aria-live', 'polite');
|
|
expect(spinnerElement).toHaveAttribute('aria-busy', 'true');
|
|
});
|
|
|
|
test('matches snapshot', () => {
|
|
const { asFragment } = render(<LoadingSpinner />);
|
|
expect(asFragment()).toMatchSnapshot();
|
|
});
|
|
}); |