feat(ui): show read-only transcription header without an edit tab (#697)

TranscriptionPanelHeader gains a canEdit prop (default true). Editors keep
the Lesen/Bearbeiten segmented toggle; read-only users get a plain
"Transkription" heading instead of a lone single-option pill, while the
"N Abschnitte" status line stays visible.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-31 12:19:36 +02:00
parent d1b24c905f
commit c5d62bef71
2 changed files with 65 additions and 31 deletions

View File

@@ -22,6 +22,27 @@ describe('TranscriptionPanelHeader', () => {
await expect.element(page.getByRole('button', { name: /bearbeiten/i })).toBeVisible();
});
it('renders both tabs when canEdit is true', async () => {
render(TranscriptionPanelHeader, { ...baseProps, canEdit: true });
await expect.element(page.getByTestId('mode-read')).toBeInTheDocument();
await expect.element(page.getByTestId('mode-edit')).toBeInTheDocument();
});
it('hides the edit tab and shows a plain title when canEdit is false', async () => {
render(TranscriptionPanelHeader, { ...baseProps, canEdit: false });
await expect.element(page.getByTestId('mode-edit')).not.toBeInTheDocument();
await expect.element(page.getByTestId('mode-read')).not.toBeInTheDocument();
await expect.element(page.getByRole('heading', { name: /^transkription$/i })).toBeVisible();
});
it('keeps the section status line visible for readers (canEdit false)', async () => {
render(TranscriptionPanelHeader, { ...baseProps, canEdit: false, blockCount: 3 });
await expect.element(page.getByText('3 Abschnitte')).toBeVisible();
});
it('marks the Lesen button as aria-disabled when hasBlocks is false', async () => {
render(TranscriptionPanelHeader, {
...baseProps,