fix(review): GeschichtenCard uses GeschichteSummary type; focus-visible on journey links; fix stale tests
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 3m17s
CI / OCR Service Tests (pull_request) Successful in 23s
CI / Backend Unit Tests (pull_request) Successful in 3m42s
CI / fail2ban Regex (pull_request) Successful in 47s
CI / Semgrep Security Scan (pull_request) Successful in 22s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m4s

- GeschichtenCard.svelte: use GeschichteSummary instead of Geschichte
  (list endpoint returns summaries; no items/createdAt/updatedAt needed)
- GeschichtenCard.svelte.test.ts: factory returns GeschichteSummary with
  lean author shape; drop Geschichte-only fields (createdAt, groups, etc.)
- geschichten/[id]/+page.svelte: add focus:outline-none focus-visible:ring-2
  focus-visible:ring-focus-ring to journey item document links (WCAG 2.4.7)
- page.svelte.test.ts ([id]): replace stale documents[] factory field with
  items[]; test now checks placeholder text + note caption
- page.svelte.test.ts (new): remove removed initialDocuments from baseData;
  rename test to reflect that only initialPersons is passed through

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-08 16:01:50 +02:00
parent 45500cc5e2
commit df5d880e09
5 changed files with 18 additions and 30 deletions

View File

@@ -108,7 +108,7 @@ async function handleDelete() {
<li>
<a
href="/documents/{item.documentId}"
class="block rounded border border-line bg-surface px-4 py-3 font-serif text-base text-ink hover:bg-muted"
class="block rounded border border-line bg-surface px-4 py-3 font-serif text-base text-ink hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring"
>
{m.geschichten_document_link_placeholder()}
</a>

View File

@@ -19,7 +19,7 @@ const baseGeschichte = (overrides: Record<string, unknown> = {}) => ({
email: string;
} | null,
persons: [] as { id: string; displayName: string }[],
documents: [] as { id: string; title: string; documentDate?: string | null }[],
items: [] as { id: string; documentId?: string; position: number; note?: string }[],
...overrides
});
@@ -130,20 +130,21 @@ describe('geschichten/[id] page', () => {
await expect.element(page.getByText('Erwähnte Dokumente')).not.toBeInTheDocument();
});
it('renders the documents section when there are linked documents', async () => {
it('renders the documents section when there are linked journey items', async () => {
render(GeschichtePage, {
context: new Map([[CONFIRM_KEY, createConfirmService()]]),
props: {
data: baseData({
geschichte: baseGeschichte({
documents: [{ id: 'd1', title: 'Brief 1923', documentDate: '1923-04-15' }]
items: [{ id: 'item1', documentId: 'd1', position: 0, note: 'Brief aus 1923' }]
})
})
}
});
await expect.element(page.getByText('Erwähnte Dokumente')).toBeVisible();
await expect.element(page.getByText('Brief 1923')).toBeVisible();
await expect.element(page.getByText('Dokument öffnen')).toBeVisible();
await expect.element(page.getByText('Brief aus 1923')).toBeVisible();
});
it('renders edit and delete actions when canBlogWrite is true', async () => {

View File

@@ -21,8 +21,7 @@ const { default: GeschichtenNewPage } = await import('./+page.svelte');
afterEach(cleanup);
const baseData = {
initialPersons: [] as { id: string; displayName: string }[],
initialDocuments: [] as { id: string; title: string }[]
initialPersons: [] as { id: string; displayName: string }[]
};
describe('geschichten/new page', () => {
@@ -53,18 +52,15 @@ describe('geschichten/new page', () => {
expect(inputs.length).toBeGreaterThan(0);
});
it('passes initialPersons and initialDocuments through to the editor', async () => {
it('passes initialPersons through to the editor', async () => {
render(GeschichtenNewPage, {
props: {
data: {
initialPersons: [{ id: 'p1', displayName: 'Anna Schmidt' }],
initialDocuments: [{ id: 'd1', title: 'Brief 1923' }]
initialPersons: [{ id: 'p1', displayName: 'Anna Schmidt' }]
}
}
});
// Both should appear somewhere in the rendered editor
await expect.element(page.getByText('Anna Schmidt')).toBeVisible();
await expect.element(page.getByText('Brief 1923')).toBeVisible();
});
});