From 25e6e976b7c532108c6062c5774dc031ab8af480 Mon Sep 17 00:00:00 2001
From: Yif <877193178@qq.com>
Date: Sun, 13 Sep 2026 13:28:16 +0800
Subject: [PATCH] test(sidebar-documentpreview): cover the visible-label
loading branch and drop the stale single-viewer control from the
seeded-history golden
---
.../tests/loading-indicator.client.spec.tsx | 23 +++++++++++++++++++
.../seeded-history/file-preview.expected.md | 1 -
2 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 packages/client/ui-sidebar-documentpreview/tests/loading-indicator.client.spec.tsx
diff --git a/packages/client/ui-sidebar-documentpreview/tests/loading-indicator.client.spec.tsx b/packages/client/ui-sidebar-documentpreview/tests/loading-indicator.client.spec.tsx
new file mode 100644
index 0000000000..517ab8e704
--- /dev/null
+++ b/packages/client/ui-sidebar-documentpreview/tests/loading-indicator.client.spec.tsx
@@ -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()
+ 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()
+ const status = getByRole('status')
+ expect(status.textContent).toBe('')
+ expect(status.getAttribute('aria-label')).toBe('Reading…')
+ })
+})
diff --git a/snapshots/web/seeded-history/file-preview.expected.md b/snapshots/web/seeded-history/file-preview.expected.md
index 9cc9064145..d11b2479b2 100644
--- a/snapshots/web/seeded-history/file-preview.expected.md
+++ b/snapshots/web/seeded-history/file-preview.expected.md
@@ -1,5 +1,4 @@
- text: {{cwd}}/a.txt
-- button "Open with": Plain text
- button "Line wrap" [pressed]:
- img
- button "Read the file again":