diff --git a/frontend/src/lib/document/DocumentPickerDropdown.svelte.spec.ts b/frontend/src/lib/document/DocumentPickerDropdown.svelte.spec.ts index 7529af4f..e60ef3be 100644 --- a/frontend/src/lib/document/DocumentPickerDropdown.svelte.spec.ts +++ b/frontend/src/lib/document/DocumentPickerDropdown.svelte.spec.ts @@ -85,7 +85,8 @@ describe('DocumentPickerDropdown — selection', () => { await userEvent.fill(page.getByRole('combobox'), 'Brief'); await waitForDebounce(); - await userEvent.click(page.getByRole('option', { name: /Brief von Eugenie/i })); + // aria-disabled items are not "enabled" — userEvent refuses them; use force click + await page.getByRole('option', { name: /Brief von Eugenie/i }).click({ force: true }); expect(onSelect).not.toHaveBeenCalled(); }); diff --git a/frontend/src/lib/document/transcription/useBlockDragDrop.svelte.test.ts b/frontend/src/lib/document/transcription/useBlockDragDrop.svelte.test.ts index 90afcad0..f65f2dd5 100644 --- a/frontend/src/lib/document/transcription/useBlockDragDrop.svelte.test.ts +++ b/frontend/src/lib/document/transcription/useBlockDragDrop.svelte.test.ts @@ -25,6 +25,8 @@ describe('createBlockDragDrop — generic type guard', () => { it('TranscriptionBlockData caller still compiles — regression guard for existing transcription editor', () => { // If the generic constraint is wrong this line fails tsc --noEmit expectTypeOf(createBlockDragDrop).toBeFunction(); + // Runtime assertion so browser-mode doesn't report "no assertions" + expect(typeof createBlockDragDrop).toBe('function'); }); }); diff --git a/frontend/src/lib/geschichte/JourneyAddBar.svelte.spec.ts b/frontend/src/lib/geschichte/JourneyAddBar.svelte.spec.ts index 8fd7409b..18c4936c 100644 --- a/frontend/src/lib/geschichte/JourneyAddBar.svelte.spec.ts +++ b/frontend/src/lib/geschichte/JourneyAddBar.svelte.spec.ts @@ -11,7 +11,7 @@ describe('JourneyAddBar — interlude flow', () => { await userEvent.click(page.getByText('Zwischentext hinzufügen')); - const confirmBtn = page.getByRole('button', { name: 'Hinzufügen' }); + const confirmBtn = page.getByRole('button', { name: 'Hinzufügen', exact: true }); await expect.element(confirmBtn).toHaveAttribute('aria-disabled', 'true'); }); @@ -21,7 +21,7 @@ describe('JourneyAddBar — interlude flow', () => { await userEvent.click(page.getByText('Zwischentext hinzufügen')); await userEvent.fill(page.getByRole('textbox'), 'Eine schöne Reise'); - const confirmBtn = page.getByRole('button', { name: 'Hinzufügen' }); + const confirmBtn = page.getByRole('button', { name: 'Hinzufügen', exact: true }); await expect.element(confirmBtn).toHaveAttribute('aria-disabled', 'false'); }); @@ -31,7 +31,7 @@ describe('JourneyAddBar — interlude flow', () => { await userEvent.click(page.getByText('Zwischentext hinzufügen')); await userEvent.fill(page.getByRole('textbox'), 'Reise nach Wien'); - await userEvent.click(page.getByRole('button', { name: 'Hinzufügen' })); + await userEvent.click(page.getByRole('button', { name: 'Hinzufügen', exact: true })); expect(onAddInterlude).toHaveBeenCalledWith('Reise nach Wien'); }); diff --git a/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts b/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts index 2fd455e8..52f51ea8 100644 --- a/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts +++ b/frontend/src/lib/geschichte/JourneyEditor.svelte.spec.ts @@ -47,9 +47,8 @@ afterEach(() => { describe('JourneyEditor — empty state', () => { it('renders title input and intro textarea', async () => { render(JourneyEditor, defaultProps()); - await expect.element(page.getByRole('textbox', { name: /Titel/ })).not.toBeInTheDocument(); // input has no aria-label - // title input has placeholder text await expect.element(page.getByPlaceholder(/Titel/)).toBeInTheDocument(); + await expect.element(page.getByPlaceholder(/Einleitung/)).toBeInTheDocument(); }); it('publish button disabled when no items', async () => { @@ -80,6 +79,7 @@ describe('JourneyEditor — publish disabled when title empty', () => { JourneyEditor, defaultProps({ geschichte: makeGeschichte({ + title: '', items: [{ id: 'i1', position: 0, document: docSummary('d1', 'Brief A') }] }) }) @@ -163,8 +163,8 @@ describe('JourneyEditor — add interlude', () => { render(JourneyEditor, defaultProps()); await userEvent.click(page.getByText('Zwischentext hinzufügen')); - await userEvent.fill(page.getByRole('textbox'), 'Reise nach Wien'); - await userEvent.click(page.getByRole('button', { name: 'Hinzufügen' })); + await userEvent.fill(page.getByPlaceholder('Zwischentext eingeben…'), 'Reise nach Wien'); + await userEvent.click(page.getByRole('button', { name: 'Hinzufügen', exact: true })); expect(globalThis.fetch).toHaveBeenCalledWith( expect.stringContaining('/items'), @@ -203,8 +203,8 @@ describe('JourneyEditor — remove with rollback', () => { // Add interlude (no unsaved warning should interfere) await userEvent.click(page.getByText('Zwischentext hinzufügen')); - await userEvent.fill(page.getByRole('textbox'), 'Test'); - await userEvent.click(page.getByRole('button', { name: 'Hinzufügen' })); + await userEvent.fill(page.getByPlaceholder('Zwischentext eingeben…'), 'Test'); + await userEvent.click(page.getByRole('button', { name: 'Hinzufügen', exact: true })); // Saving (which requires non-empty title) — no unsaved warning dialog await expect.element(page.getByRole('dialog')).not.toBeInTheDocument();