diff --git a/frontend/src/lib/components/DashboardMentions.svelte b/frontend/src/lib/components/DashboardMentions.svelte deleted file mode 100644 index 176d5fa3..00000000 --- a/frontend/src/lib/components/DashboardMentions.svelte +++ /dev/null @@ -1,57 +0,0 @@ - - -{#if mentions.length > 0} -
-

- {m.dashboard_notifications_heading()} -

-
- {#each mentions as mention (mention.id)} -
- {#if mention.documentId} - {mention.actorName ?? ''} - - {mention.type === 'MENTION' - ? m.dashboard_notification_mentioned() - : m.dashboard_notification_replied()} - - {:else} - {mention.actorName ?? ''} - {/if} -
- {/each} -
-
- {m.notification_history_view_link()} -
-
-{/if} diff --git a/frontend/src/lib/components/DashboardMentions.svelte.spec.ts b/frontend/src/lib/components/DashboardMentions.svelte.spec.ts deleted file mode 100644 index 10643825..00000000 --- a/frontend/src/lib/components/DashboardMentions.svelte.spec.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { describe, it, expect, afterEach } from 'vitest'; -import { cleanup, render } from 'vitest-browser-svelte'; -import { page } from 'vitest/browser'; - -import DashboardMentions from './DashboardMentions.svelte'; - -afterEach(cleanup); - -type NotificationDTO = { - id: string; - type: 'REPLY' | 'MENTION'; - documentId?: string; - referenceId?: string; - annotationId?: string; - read: boolean; - createdAt: string; - actorName?: string; -}; - -function makeMention(overrides: Partial = {}): NotificationDTO { - return { - id: 'notif-1', - type: 'MENTION', - documentId: 'doc-abc', - referenceId: 'comment-xyz', - read: false, - createdAt: '2026-01-15T10:00:00Z', - actorName: 'Anna Schmidt', - ...overrides - }; -} - -describe('DashboardMentions', () => { - it('renders nothing when mentions list is empty', async () => { - render(DashboardMentions, { mentions: [] }); - const widget = page.getByTestId('dashboard-mentions'); - await expect.element(widget).not.toBeInTheDocument(); - }); - - it('shows a heading when mentions are present', async () => { - render(DashboardMentions, { mentions: [makeMention()] }); - const widget = page.getByTestId('dashboard-mentions'); - await expect.element(widget).toBeInTheDocument(); - }); - - it('builds link with commentId param when no annotationId', async () => { - render(DashboardMentions, { - mentions: [makeMention({ documentId: 'doc-1', referenceId: 'cmt-1' })] - }); - const link = page.getByRole('link', { name: 'Anna Schmidt' }); - await expect.element(link).toHaveAttribute('href', '/documents/doc-1?commentId=cmt-1'); - }); - - it('builds link with commentId and annotationId when annotationId is present', async () => { - render(DashboardMentions, { - mentions: [makeMention({ documentId: 'doc-2', referenceId: 'cmt-2', annotationId: 'ann-9' })] - }); - const link = page.getByRole('link', { name: 'Anna Schmidt' }); - await expect - .element(link) - .toHaveAttribute('href', '/documents/doc-2?commentId=cmt-2&annotationId=ann-9'); - }); - - it('shows actor name in each row', async () => { - render(DashboardMentions, { mentions: [makeMention({ actorName: 'Maria Müller' })] }); - await expect.element(page.getByText('Maria Müller')).toBeInTheDocument(); - }); - - it('shows "replied" label for REPLY type', async () => { - render(DashboardMentions, { mentions: [makeMention({ type: 'REPLY' })] }); - const widget = page.getByTestId('dashboard-mentions'); - await expect.element(widget).toBeInTheDocument(); - const link = page.getByRole('link', { name: 'Anna Schmidt' }); - await expect.element(link).toBeInTheDocument(); - }); - - it('renders a span instead of a link when documentId is absent', async () => { - render(DashboardMentions, { - mentions: [makeMention({ documentId: undefined, actorName: 'Lena Bauer' })] - }); - await expect.element(page.getByText('Lena Bauer')).toBeInTheDocument(); - const actorLink = page.getByRole('link', { name: 'Lena Bauer' }); - await expect.element(actorLink).not.toBeInTheDocument(); - }); -});