diff --git a/frontend/src/lib/components/DocumentRow.svelte b/frontend/src/lib/components/DocumentRow.svelte index c5659eb7..e5fcf385 100644 --- a/frontend/src/lib/components/DocumentRow.svelte +++ b/frontend/src/lib/components/DocumentRow.svelte @@ -36,8 +36,8 @@ const hasMore = $derived(item.contributors.length >= 4); function tagClass(matched: boolean): string { return matched - ? 'inline-flex items-center gap-1 rounded px-2 py-1.5 text-xs font-bold tracking-widest uppercase bg-primary text-primary-fg transition-colors' - : 'inline-flex items-center gap-1 rounded px-2 py-1.5 text-xs font-bold tracking-widest uppercase bg-muted text-ink hover:bg-primary hover:text-primary-fg transition-colors'; + ? 'pointer-events-auto inline-flex items-center gap-1 rounded px-2 py-1.5 text-xs font-bold tracking-widest uppercase bg-primary text-primary-fg transition-colors' + : 'pointer-events-auto inline-flex items-center gap-1 rounded px-2 py-1.5 text-xs font-bold tracking-widest uppercase bg-muted text-ink hover:bg-primary hover:text-primary-fg transition-colors'; } function safeTagColor(color: string | null | undefined): string { @@ -45,8 +45,15 @@ function safeTagColor(color: string | null | undefined): string { } -
  • - +
  • + + +
    @@ -124,7 +131,7 @@ function safeTagColor(color: string | null | undefined): string {
    - +
  • diff --git a/frontend/src/lib/components/DocumentRow.svelte.spec.ts b/frontend/src/lib/components/DocumentRow.svelte.spec.ts index f71c9179..274062a6 100644 --- a/frontend/src/lib/components/DocumentRow.svelte.spec.ts +++ b/frontend/src/lib/components/DocumentRow.svelte.spec.ts @@ -1,12 +1,16 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render } from 'vitest-browser-svelte'; import { page } from 'vitest/browser'; +import { goto } from '$app/navigation'; import DocumentRow from './DocumentRow.svelte'; import type { components } from '$lib/generated/api'; vi.mock('$app/navigation', () => ({ goto: vi.fn() })); -afterEach(() => cleanup()); +afterEach(() => { + cleanup(); + vi.mocked(goto).mockClear(); +}); type DocumentSearchItem = components['schemas']['DocumentSearchItem']; @@ -229,7 +233,6 @@ describe('DocumentRow – tags', () => { }); it('navigates to /documents?tag=… on tag click', async () => { - const { goto } = await import('$app/navigation'); const item = makeItem({ document: { ...makeItem().document, @@ -237,8 +240,15 @@ describe('DocumentRow – tags', () => { } }); render(DocumentRow, { item }); - await page.getByRole('button', { name: 'Urlaub & Reise' }).click(); - expect(goto).toHaveBeenCalledWith('/documents?tag=Urlaub%20%26%20Reise'); + // Tailwind CSS isn't loaded in the vitest-browser client project, so the + // `z-10` that elevates the content wrapper above the stretched-link + // overlay anchor has no effect here — Playwright's coordinate-based + // click would hit the anchor instead of the tag button. Fire the click + // directly on the button to verify the handler logic. + document.querySelector('button')?.click(); + await expect + .poll(() => vi.mocked(goto).mock.calls[0]?.[0]) + .toBe('/documents?tag=Urlaub%20%26%20Reise'); }); it('tag click does not navigate to the document detail page', async () => {