test(sidebar-documentpreview): cover the visible-label loading branch and drop the stale single-viewer control from the seeded-history golden

This commit is contained in:
Yif committed 2026-09-13 13:28:16 +08:00
1 parent 20d78f0e77
commit 25e6e976b7
2 files changed
+23 -1

No files matched your search

@@ -0,0 +1,23 @@
// @vitest-environment jsdom
/** The shared loading status: visible label by default, icon-only on request. */
import { afterEach, describe, expect, it } from 'vitest'
import { cleanup, render } from '@testing-library/react'
import { LoadingIndicator } from '../src/client/LoadingIndicator.tsx'
afterEach(cleanup)
describe('LoadingIndicator', () => {
it('shows the label beside the spinner by default', () => {
const { getByRole } = render(<LoadingIndicator label="Reading…" />)
const status = getByRole('status')
expect(status.textContent).toBe('Reading…')
expect(status.getAttribute('aria-label')).toBeNull()
})
it('moves the label to the accessible name when icon-only', () => {
const { getByRole } = render(<LoadingIndicator label="Reading…" iconOnly />)
const status = getByRole('status')
expect(status.textContent).toBe('')
expect(status.getAttribute('aria-label')).toBe('Reading…')
})
})
@@ -1,5 +1,4 @@
- text: {{cwd}}/a.txt
- button "Open with": Plain text
- button "Line wrap" [pressed]:
- img
- button "Read the file again":