import { render, screen } from '@testing-library/react' import { describe, expect, it } from 'vitest' import { expectNoA11yViolations } from '../test/a11y' import { Spinner } from './Spinner' describe('Spinner', () => { it('is a status named "Loading" by default', () => { render() const status = screen.getByRole('status', { name: 'Loading' }) expect(status).toHaveAttribute('aria-label', 'Loading') // One accessible name, no duplicate visually hidden text. expect(status).toHaveTextContent('') expect(status.querySelector('svg')).toHaveAttribute('aria-hidden', 'true') }) it('uses a custom label', () => { render() expect(screen.getByRole('status', { name: 'Saving invoice' })).toBeInTheDocument() }) it('has no axe violations', async () => { const { container } = render() await expectNoA11yViolations(container) }) })