feat(timeline): add the "· historisch" descriptor to world bands (REQ-009)

A HISTORICAL band's subtitle now carries the visible "historisch" register
inline as plain text: "{date} · historisch", or — for a RANGE — after the
existing 1914–1918 span pill (whose Zeitraum aria-label is unchanged). The
descriptor is a text node, never a second pill. Every WorldBand is
historical, so the suffix also trails an undated band on its own.

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

View File

@@ -1,5 +1,6 @@
import { describe, it, expect, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import * as m from '$lib/paraglide/messages.js';
import WorldBand from './WorldBand.svelte';
import { makeEntry } from './test-factories';
@@ -45,4 +46,23 @@ describe('WorldBand', () => {
expect(document.body.textContent).toContain('Erster Weltkrieg');
expect(document.body.textContent).toContain('1914');
});
it('appends the inline "· historisch" descriptor to a non-RANGE band (#833 REQ-009)', () => {
render(WorldBand, {
entry: historical({ precision: 'APPROX', eventDate: '1923-01-01', eventDateEnd: undefined })
});
expect(document.querySelector('[data-testid="world-range"]')).toBeNull();
expect(document.body.textContent).toContain(m.timeline_layer_historical_suffix());
});
it('follows the RANGE span pill with inline "· historisch" text, not a second pill (#833 REQ-009)', () => {
render(WorldBand, { entry: historical() });
const pill = document.querySelector('[data-testid="world-range"]');
expect(pill).not.toBeNull();
// The #779 span pill + its Zeitraum aria-label are unchanged.
expect(pill?.getAttribute('aria-label')).toBe('Zeitraum: 1914 bis 1918');
// The descriptor is plain text outside the pill, not a second styled pill.
expect(pill?.textContent).not.toContain(m.timeline_layer_historical_suffix());
expect(document.body.textContent).toContain(m.timeline_layer_historical_suffix());
});
});