diff --git a/frontend/src/lib/timeline/WorldBand.svelte b/frontend/src/lib/timeline/WorldBand.svelte index 92519535..7d71e1fd 100644 --- a/frontend/src/lib/timeline/WorldBand.svelte +++ b/frontend/src/lib/timeline/WorldBand.svelte @@ -21,6 +21,9 @@ const fromYear = $derived(entry.eventDate ? entry.eventDate.slice(0, 4) : null); const toYear = $derived(entry.eventDateEnd ? entry.eventDateEnd.slice(0, 4) : null); const showSpan = $derived(entry.precision === 'RANGE' && fromYear != null && toYear != null); const dateText = $derived(showSpan ? null : entry.precision === 'RANGE' ? fromYear : dateLabel); +// Every WorldBand is a HISTORICAL band, so the visible "historisch" register +// always trails the subtitle as plain text — never a second pill (REQ-009). +const historical = $derived(m.timeline_layer_historical_suffix());
@@ -37,7 +40,10 @@ const dateText = $derived(showSpan ? null : entry.precision === 'RANGE' ? fromYe > {fromYear}–{toYear} + · {historical} {:else if dateText} - {dateText} + {dateText} · {historical} + {:else} + {historical} {/if}
diff --git a/frontend/src/lib/timeline/WorldBand.svelte.spec.ts b/frontend/src/lib/timeline/WorldBand.svelte.spec.ts index 497f51b3..0218206f 100644 --- a/frontend/src/lib/timeline/WorldBand.svelte.spec.ts +++ b/frontend/src/lib/timeline/WorldBand.svelte.spec.ts @@ -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()); + }); });