feat(dashboard): complete frontend redesign for Issue #271
Some checks failed
CI / OCR Service Tests (push) Successful in 29s
CI / Backend Unit Tests (push) Failing after 1m21s
CI / Unit & Component Tests (push) Failing after 2m37s
CI / Unit & Component Tests (pull_request) Failing after 2m27s
CI / OCR Service Tests (pull_request) Successful in 30s
CI / Backend Unit Tests (pull_request) Failing after 1m21s
Some checks failed
CI / OCR Service Tests (push) Successful in 29s
CI / Backend Unit Tests (push) Failing after 1m21s
CI / Unit & Component Tests (push) Failing after 2m37s
CI / Unit & Component Tests (pull_request) Failing after 2m27s
CI / OCR Service Tests (pull_request) Successful in 30s
CI / Backend Unit Tests (pull_request) Failing after 1m21s
- +layout.svelte: Upload button in header (authenticated users only) - +page.server.ts: call /api/dashboard/resume, /pulse, /activity; remove deprecated /api/documents/incomplete and /recent-activity - +page.svelte: 2-col grid layout (main + 320px sidebar), greeting, DashboardFamilyPulse + DashboardActivityFeed in sidebar - DashboardResumeStrip: refactored to use server data (resumeDoc prop), SVG thumbnail, progress bar with aria-*, empty state, CTA - DashboardFamilyPulse: new component — weekly stats from audit_log - DashboardActivityFeed: new component — activity feed with "für dich" badge - Update specs for new data shapes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,48 +3,48 @@ import { cleanup, render } from 'vitest-browser-svelte';
|
||||
import { page } from 'vitest/browser';
|
||||
|
||||
import DashboardResumeStrip from './DashboardResumeStrip.svelte';
|
||||
import type { components } from '$lib/generated/api';
|
||||
|
||||
type DashboardResumeDTO = components['schemas']['DashboardResumeDTO'];
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
const mockResume: DashboardResumeDTO = {
|
||||
documentId: 'doc-123',
|
||||
title: 'Geburtsurkunde 1920',
|
||||
caption: 'Max Mustermann · 1920-01-01',
|
||||
excerpt: 'Hiermit wird beurkundet…',
|
||||
page: 1,
|
||||
pages: 4,
|
||||
pct: 75,
|
||||
collaborators: []
|
||||
};
|
||||
|
||||
describe('DashboardResumeStrip', () => {
|
||||
it('renders nothing when no last-visited document in localStorage', async () => {
|
||||
render(DashboardResumeStrip, {});
|
||||
const strip = page.getByTestId('resume-strip');
|
||||
await expect.element(strip).not.toBeInTheDocument();
|
||||
it('renders empty state heading when resumeDoc is null', async () => {
|
||||
render(DashboardResumeStrip, { resumeDoc: null });
|
||||
const heading = page.getByRole('heading', { name: /Noch kein Dokument begonnen/i });
|
||||
await expect.element(heading).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows the strip with link when localStorage has a document', async () => {
|
||||
localStorage.setItem(
|
||||
'familienarchiv.lastVisited',
|
||||
JSON.stringify({ id: 'doc-123', title: 'Geburtsurkunde 1920' })
|
||||
);
|
||||
render(DashboardResumeStrip, {});
|
||||
const strip = page.getByTestId('resume-strip');
|
||||
await expect.element(strip).toBeInTheDocument();
|
||||
const link = page.getByRole('link', { name: /Geburtsurkunde 1920/ });
|
||||
await expect.element(link).toBeInTheDocument();
|
||||
it('renders progressbar with correct aria-valuenow when resumeDoc is provided', async () => {
|
||||
render(DashboardResumeStrip, { resumeDoc: mockResume });
|
||||
const bar = page.getByRole('progressbar');
|
||||
await expect.element(bar).toBeInTheDocument();
|
||||
await expect.element(bar).toHaveAttribute('aria-valuenow', '75');
|
||||
});
|
||||
|
||||
it('shows document title when resumeDoc is provided', async () => {
|
||||
render(DashboardResumeStrip, { resumeDoc: mockResume });
|
||||
const title = page.getByRole('heading', { name: /Geburtsurkunde 1920/i });
|
||||
await expect.element(title).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('links to the document for the CTA', async () => {
|
||||
render(DashboardResumeStrip, { resumeDoc: mockResume });
|
||||
const link = page.getByRole('link', { name: /Weitertranskribieren/i });
|
||||
await expect.element(link).toHaveAttribute('href', '/documents/doc-123');
|
||||
});
|
||||
|
||||
it('uses title fallback text when title is empty', async () => {
|
||||
localStorage.setItem(
|
||||
'familienarchiv.lastVisited',
|
||||
JSON.stringify({ id: 'doc-456', title: '' })
|
||||
);
|
||||
render(DashboardResumeStrip, {});
|
||||
const strip = page.getByTestId('resume-strip');
|
||||
await expect.element(strip).toBeInTheDocument();
|
||||
const link = page.getByRole('link');
|
||||
await expect.element(link).toHaveAttribute('href', '/documents/doc-456');
|
||||
});
|
||||
|
||||
it('renders nothing when localStorage contains malformed JSON', async () => {
|
||||
localStorage.setItem('familienarchiv.lastVisited', '{not valid json');
|
||||
render(DashboardResumeStrip, {});
|
||||
const strip = page.getByTestId('resume-strip');
|
||||
await expect.element(strip).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user