refactor(timeline): render the WorldBand historical suffix once
The "· historisch" register was emitted in all three date branches, with the dateless branch dropping the leading separator. Render the span pill or date as a conditional prefix, then a single trailing "· historisch" span — one render site, consistent separator. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -40,10 +40,10 @@ const historical = $derived(m.timeline_layer_historical_suffix());
|
||||
>
|
||||
{fromYear}–{toYear}
|
||||
</span>
|
||||
<span class="font-sans text-xs text-ink-3"> · {historical}</span>
|
||||
{:else if dateText}
|
||||
<span class="ml-2 font-sans text-xs text-ink-3">{dateText} · {historical}</span>
|
||||
{:else}
|
||||
<span class="ml-2 font-sans text-xs text-ink-3">{historical}</span>
|
||||
<span class="ml-2 font-sans text-xs text-ink-3">{dateText}</span>
|
||||
{/if}
|
||||
<!-- Single trailing "· historisch" register, after the title and any
|
||||
span pill / date — one render site, consistent separator (REQ-009). -->
|
||||
<span class="ml-2 font-sans text-xs text-ink-3">· {historical}</span>
|
||||
</div>
|
||||
|
||||
@@ -55,6 +55,14 @@ describe('WorldBand', () => {
|
||||
expect(document.body.textContent).toContain(m.timeline_layer_historical_suffix());
|
||||
});
|
||||
|
||||
it('shows "· historisch" with a leading separator even when the band has no date (#833 REQ-009)', () => {
|
||||
render(WorldBand, {
|
||||
entry: historical({ precision: 'UNKNOWN', eventDate: undefined, 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"]');
|
||||
|
||||
Reference in New Issue
Block a user