DocumentDate rendered an "Originaltext: <raw>" secondary line for
UNKNOWN/SEASON/APPROX dates, gated by a showRaw prop. Drop the visible
line, the showRaw prop, the showRawLine derived, and the now-unused
date_original_label message import. The raw prop stays — it still feeds
the SEASON word in formatDocumentDate, which only ever maps a fixed
German season token (never emits raw text), so no XSS surface remains.
Update both DocumentRow call sites to drop the now-gone showRaw={false}
and the comment that justified it. Remove the two DocumentDate tests
that asserted on the deleted DOM sink (the UNKNOWN secondary line and
its XSS-escaping); the DAY/MONTH coverage stays.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
21 lines
786 B
TypeScript
21 lines
786 B
TypeScript
import { describe, it, expect, afterEach } from 'vitest';
|
|
import { cleanup, render } from 'vitest-browser-svelte';
|
|
import { page } from 'vitest/browser';
|
|
import DocumentDate from './DocumentDate.svelte';
|
|
|
|
// Browser-project (Playwright) tests — CI only.
|
|
|
|
afterEach(cleanup);
|
|
|
|
describe('DocumentDate', () => {
|
|
it('renders a DAY date as a full long date', async () => {
|
|
render(DocumentDate, { props: { iso: '1943-12-24', precision: 'DAY' } });
|
|
await expect.element(page.getByText('24. Dezember 1943')).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders MONTH precision as month + year, never a day', async () => {
|
|
render(DocumentDate, { props: { iso: '1916-06-01', precision: 'MONTH', raw: 'Juni 1916' } });
|
|
await expect.element(page.getByText('Juni 1916')).toBeInTheDocument();
|
|
});
|
|
});
|