Converts the module-singleton notificationStore into a context-provided store so its specs can drive it without mocking the module. notifications.svelte now exports createNotificationStore() (the former singleton body), plus provideNotificationStore()/getNotificationStore()/NOTIFICATION_KEY mirroring the confirm service. Root +layout provides it; NotificationBell and the Chronik page read it via getNotificationStore(). Tests: - notifications.svelte.spec drives a fresh createNotificationStore() per test (replacing __resetForTest/__setNavigateForTest with setNavigate()). - notification.test-fixture.svelte wraps the bell, provides the store, and exposes setNotifications(items) via onReady (option b). - NotificationBell.svelte.spec asserts the announced unread count across the empty / single / many / error a11y states (AC#5), stubbing EventSource+fetch. - aktivitaeten page spec injects a real store via render context. Per the recorded Phase-2b decision (full context refactor). Part of #560. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 lines
430 B
Svelte
14 lines
430 B
Svelte
<script lang="ts">
|
|
import { provideNotificationStore, type NotificationItem } from './notifications.svelte';
|
|
import NotificationBell from './NotificationBell.svelte';
|
|
|
|
type Api = { setNotifications: (items: NotificationItem[]) => void };
|
|
|
|
let { onReady }: { onReady: (api: Api) => void } = $props();
|
|
|
|
const store = provideNotificationStore();
|
|
onReady({ setNotifications: store.setNotifications });
|
|
</script>
|
|
|
|
<NotificationBell />
|