test(ui): add tests for 0 blocks and lastEditedAt on PanelHeader

Verifies blockCount=0 shows "0 Abschnitte" and that a provided
lastEditedAt value renders a formatted date containing the year.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-07 11:46:53 +02:00
parent b312878b3f
commit 1b063d4e4b

View File

@@ -105,4 +105,32 @@ describe('TranscriptionPanelHeader', () => {
await expect.element(page.getByText('5 Abschnitte')).toBeInTheDocument();
});
it('should show "0 Abschnitte" when blockCount is 0', async () => {
render(TranscriptionPanelHeader, {
mode: 'edit',
hasBlocks: false,
blockCount: 0,
lastEditedAt: null,
onModeChange: () => {},
onClose: () => {}
});
await expect.element(page.getByText('0 Abschnitte')).toBeInTheDocument();
});
it('should show formatted date when lastEditedAt is provided', async () => {
render(TranscriptionPanelHeader, {
mode: 'read',
hasBlocks: true,
blockCount: 3,
lastEditedAt: '2026-04-07T10:00:00Z',
onModeChange: () => {},
onClose: () => {}
});
const statusText = document.querySelector('.hidden.md\\:block');
expect(statusText).not.toBeNull();
expect(statusText!.textContent).toContain('2026');
});
});