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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user