diff --git a/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts b/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts index 4eed135c..32f2c048 100644 --- a/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts +++ b/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts @@ -280,6 +280,36 @@ describe('JourneyEditor — reorder via move buttons', () => { }); }); +describe('JourneyEditor — live announce region', () => { + it('clears the live announce region 500ms after a move operation', async () => { + const items = [ + { id: 'i1', position: 0, document: docSummary('d1', 'Brief A') }, + { id: 'i2', position: 1, document: docSummary('d2', 'Brief B') } + ]; + vi.stubGlobal( + 'fetch', + vi.fn().mockResolvedValue({ + ok: true, + json: vi.fn().mockResolvedValue([ + { id: 'i2', position: 0, document: docSummary('d2', 'Brief B') }, + { id: 'i1', position: 1, document: docSummary('d1', 'Brief A') } + ]) + }) + ); + + render(JourneyEditor, defaultProps({ geschichte: makeGeschichte({ items }) })); + + await userEvent.click(page.getByRole('button', { name: /Brief B.*nach oben verschieben/ })); + await new Promise((r) => setTimeout(r, 50)); // wait for csrfFetch + + const liveRegion = document.querySelector('[aria-live="polite"]'); + expect((liveRegion?.textContent ?? '').trim().length).toBeGreaterThan(0); + + await new Promise((r) => setTimeout(r, 650)); // 500ms clear timeout + buffer + expect((liveRegion?.textContent ?? '').trim()).toBe(''); + }); +}); + describe('JourneyEditor — duplicate document aria-disabled', () => { it('already-added document appears as aria-disabled in picker', async () => { const items = [{ id: 'i1', position: 0, document: docSummary('d1', 'Brief von Karl') }];