feat(timeline): paint the axis with a three-stop gradient (REQ-006)

The spine now runs mint → navy → slate, matching the spec's life-thread,
using --palette-mint / --palette-navy / --c-tag-slate (no --palette-slate
token exists). Semantic tokens only — no raw hex.

Refs #833
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-14 11:10:49 +02:00
parent 18934413bb
commit bfe66569d7
2 changed files with 28 additions and 1 deletions

View File

@@ -240,6 +240,31 @@ describe('TimelineView', () => {
expect(document.body.textContent).toContain('Geburt');
});
it('paints the axis with a three-stop mint→navy→slate gradient (REQ-006)', () => {
// The palette tokens live in layout.css, which component tests don't load,
// so define exactly the three the gradient must reference; an undefined
// fourth token would invalidate the declaration and yield "none".
const root = document.documentElement;
root.style.setProperty('--palette-mint', '#a1dcd8');
root.style.setProperty('--palette-navy', '#012851');
root.style.setProperty('--c-tag-slate', '#607080');
try {
render(TimelineView, {
timeline: makeTimelineDTO({ years: [makeYear(1914, [makeEntry()])] })
});
const axis = document.querySelector('.timeline-axis') as HTMLElement;
expect(axis).not.toBeNull();
const bg = getComputedStyle(axis, '::before').backgroundImage;
expect(bg).toContain('gradient');
// three colour stops: mint, navy, slate
expect((bg.match(/rgb/g) ?? []).length).toBe(3);
} finally {
root.style.removeProperty('--palette-mint');
root.style.removeProperty('--palette-navy');
root.style.removeProperty('--c-tag-slate');
}
});
it('places consecutive letter cards on alternating sides (REQ-004 surrogate)', () => {
const letters = Array.from({ length: 4 }, (_, i) => makeEntry({ documentId: `d${i}` }));
render(TimelineView, { timeline: makeTimelineDTO({ years: [makeYear(1909, letters)] }) });