loading-indicator.client.spec.tsx 657 B

12345678910111213141516
  1. // @vitest-environment jsdom
  2. /** The shared loading status: an icon-only spinner named by its label. */
  3. import { afterEach, describe, expect, it } from 'vitest'
  4. import { cleanup, render } from '@testing-library/react'
  5. import { LoadingIndicator } from '../src/client/LoadingIndicator.tsx'
  6. afterEach(cleanup)
  7. describe('LoadingIndicator', () => {
  8. it('renders no visible text and carries the label as the accessible name', () => {
  9. const { getByRole } = render(<LoadingIndicator label="Reading…" />)
  10. const status = getByRole('status')
  11. expect(status.textContent).toBe('')
  12. expect(status.getAttribute('aria-label')).toBe('Reading…')
  13. })
  14. })