feat(document): stop surfacing the raw cell in the detail drawer
The detail drawer's date cell rendered DocumentDate whenever a date OR a
raw cell was present (`{#if documentDate || metaDateRaw}`). For an
undated, raw-only document that meant the verbatim import text leaked
into the view. Tighten the guard to `{#if documentDate}` so such a
document shows "—". The raw prop is still passed through for the SEASON
word on dated documents. Covered by a new test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -113,7 +113,7 @@ function getFullName(person: Person): string {
|
||||
<div>
|
||||
<dt class="font-sans text-xs font-medium text-ink-3">{m.doc_details_field_date()}</dt>
|
||||
<dd class="text-ink">
|
||||
{#if documentDate || metaDateRaw}
|
||||
{#if documentDate}
|
||||
<DocumentDate
|
||||
iso={documentDate}
|
||||
precision={metaDatePrecision}
|
||||
|
||||
@@ -58,6 +58,18 @@ describe('DocumentMetadataDrawer', () => {
|
||||
expect(dashTexts.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('shows an em-dash and never the raw cell for an undated, raw-only document', async () => {
|
||||
render(DocumentMetadataDrawer, {
|
||||
props: { ...baseProps, documentDate: null, metaDateRaw: 'Sommer 1916' }
|
||||
});
|
||||
|
||||
await expect.element(page.getByText('Sommer 1916')).not.toBeInTheDocument();
|
||||
const dashTexts = Array.from(document.querySelectorAll('dd, p'))
|
||||
.map((el) => el.textContent?.trim())
|
||||
.filter((t) => t === '—');
|
||||
expect(dashTexts.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('renders the no-persons placeholder when sender and receivers are empty', async () => {
|
||||
render(DocumentMetadataDrawer, { props: baseProps });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user