From f6a0d7aa3e6ace5db8828c3bee952e784c2efd1d Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 12 May 2026 10:39:39 +0200 Subject: [PATCH 1/7] test(notification): add goto mock and tighten selector in NotificationDropdown spec Co-Authored-By: Claude Sonnet 4.6 --- .../lib/notification/NotificationDropdown.svelte.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts b/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts index d6d983df..be223bdf 100644 --- a/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts +++ b/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts @@ -1,8 +1,11 @@ import { describe, it, expect, vi, afterEach } from 'vitest'; import { cleanup, render } from 'vitest-browser-svelte'; import { page } from 'vitest/browser'; +import { goto } from '$app/navigation'; import NotificationDropdown from './NotificationDropdown.svelte'; +vi.mock('$app/navigation', () => ({ goto: vi.fn() })); + afterEach(cleanup); const makeNotification = (overrides: Record = {}) => ({ @@ -164,9 +167,10 @@ describe('NotificationDropdown', () => { } }); - await page.getByRole('link').click(); + await page.getByRole('link', { name: /alle aktivitäten|view all/i }).click(); expect(onClose).toHaveBeenCalledOnce(); + expect(goto).toHaveBeenCalledWith('/aktivitaeten'); }); it('renders MENTION items with the mention verb text', async () => { -- 2.49.1 From 0387d51e153d06b9966d8d1a63de6173ef54d27d Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 12 May 2026 10:40:13 +0200 Subject: [PATCH 2/7] =?UTF-8?q?fix(notification):=20prevent=20iframe=20nav?= =?UTF-8?q?igation=20=E2=80=94=20use=20goto=20instead=20of=20href=20follow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/notification/NotificationDropdown.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/notification/NotificationDropdown.svelte b/frontend/src/lib/notification/NotificationDropdown.svelte index c94f0a10..68ff59e0 100644 --- a/frontend/src/lib/notification/NotificationDropdown.svelte +++ b/frontend/src/lib/notification/NotificationDropdown.svelte @@ -1,4 +1,5 @@
{ e.preventDefault(); onClose(); goto('/aktivitaeten'); }} + onclick={handleViewAll} class="text-xs font-medium text-ink-2 transition-colors hover:text-ink" > {m.chronik_view_all()} -- 2.49.1 From c8d052d3078f87c7c162ff31a6ca39ce3069f823 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 12 May 2026 11:25:54 +0200 Subject: [PATCH 7/7] docs(adr-012): add overlay navigation pattern note Co-Authored-By: Claude Sonnet 4.6 --- docs/adr/012-browser-test-mocking-strategy.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/adr/012-browser-test-mocking-strategy.md b/docs/adr/012-browser-test-mocking-strategy.md index 763a7649..b1e01ead 100644 --- a/docs/adr/012-browser-test-mocking-strategy.md +++ b/docs/adr/012-browser-test-mocking-strategy.md @@ -79,6 +79,8 @@ The following `vi.mock(module, factory)` calls in browser specs are **acceptable These modules are resolved at static import time (before any test runs). Their `vi.mock` factories are served by birpc synchronously during module graph resolution, not after worker teardown. +**Pattern note:** When an overlay or dropdown contains a navigation link (``), use `e.preventDefault()` + `goto(path)` in the click handler instead of letting the browser follow the `href`. In a vitest-browser Playwright iframe there is no SvelteKit router, so a real navigation tears down the orchestrator iframe and crashes the test run. The `href` attribute should still be present for right-click / open-in-new-tab semantics. + --- ## Consequences -- 2.49.1