feat(timeline): show provenance token on the event pill (REQ-007)

The derived/curated pill subtitle now reads "{date} · abgeleitet" or
"{date} · kuratiert", keyed off entry.derived so a reader sees both the
date and whether the event was derived from Person data or curated. Only
the single provenance token ships; the spec sheet's "· persönlich" /
"· SEASON" annotations stay out (already covered by the ★ glyph + mint
border and not production UI).

Refs #833
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-14 10:42:33 +02:00
parent 808d6efa1a
commit 08d8896cd1
2 changed files with 39 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
import { describe, it, expect, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import * as m from '$lib/paraglide/messages.js';
import EventPill from './EventPill.svelte';
import { timelineDateLabel } from './dateLabel';
import { makeEntry } from './test-factories';
afterEach(() => cleanup());
@@ -87,4 +89,35 @@ describe('EventPill', () => {
render(EventPill, { entry: derived('MARRIAGE', 'Heirat') });
expect(document.querySelector('[data-testid="event-edit"]')).toBeNull();
});
it('appends the "abgeleitet" provenance token to a derived pill subtitle (REQ-007)', () => {
const entry = derived('BIRTH', 'Geburt: Hans');
const date = timelineDateLabel(entry.eventDate, entry.precision, entry.eventDateEnd);
render(EventPill, { entry });
expect(document.body.textContent).toContain(`${date} · ${m.timeline_provenance_derived()}`);
});
it('appends the "kuratiert" provenance token to a curated PERSONAL pill subtitle (REQ-007)', () => {
const entry = makeEntry({
kind: 'EVENT',
derived: false,
type: 'PERSONAL',
eventId: EVENT_ID,
title: 'Auswanderung',
senderName: '',
receiverName: '',
precision: 'YEAR',
eventDate: '1924-01-01',
documentId: undefined
});
const date = timelineDateLabel(entry.eventDate, entry.precision, entry.eventDateEnd);
render(EventPill, { entry });
expect(document.body.textContent).toContain(`${date} · ${m.timeline_provenance_curated()}`);
});
it('never shows the spec-sheet-only "persönlich"/"SEASON" tokens (REQ-007)', () => {
render(EventPill, { entry: derived('BIRTH', 'Geburt: Hans') });
expect(document.body.textContent).not.toContain('persönlich');
expect(document.body.textContent).not.toContain('SEASON');
});
});