test(document): update WhoWhenSection.test ids after DatePrecisionField extraction
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 3m58s
CI / OCR Service Tests (pull_request) Successful in 25s
CI / Backend Unit Tests (pull_request) Successful in 5m32s
CI / fail2ban Regex (pull_request) Successful in 55s
CI / Semgrep Security Scan (pull_request) Successful in 32s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m8s
SDD Gate / RTM Check (pull_request) Successful in 16s
SDD Gate / Contract Validate (pull_request) Successful in 28s
SDD Gate / Constitution Impact (pull_request) Successful in 21s

The DatePrecisionField extraction derives element ids from dateInputName, so the
document form's precision/end-date ids changed (metaDatePrecision →
documentDatePrecision, metaDateEnd → documentDateEnd, date-error →
documentDate-error, end-date-error → documentDate-end-error). The name attributes
are unchanged, so form submission is unaffected — but the pre-existing
WhoWhenSection.svelte.test.ts (a separate file from the .spec.ts) still queried
the old ids and was failing 5 assertions in CI's client project. It wasn't in
the PR diff, so the multi-persona review missed it. Re-point the selectors.

Addresses PR #832 review (round-1 clean-agent blocker).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-14 00:39:38 +02:00
parent 719274ef88
commit d330510777

View File

@@ -15,14 +15,14 @@ describe('WhoWhenSection — date input behavior', () => {
await vi.waitFor(() => { await vi.waitFor(() => {
// Invalid → border-red-400 class // Invalid → border-red-400 class
expect(dateInput.className).toContain('border-red-400'); expect(dateInput.className).toContain('border-red-400');
expect(document.querySelector('#date-error')).not.toBeNull(); expect(document.querySelector('#documentDate-error')).not.toBeNull();
}); });
}); });
it('does not show the error before the user has typed', async () => { it('does not show the error before the user has typed', async () => {
render(WhoWhenSection, {}); render(WhoWhenSection, {});
const error = document.querySelector('#date-error'); const error = document.querySelector('#documentDate-error');
expect(error).toBeNull(); expect(error).toBeNull();
}); });
@@ -77,20 +77,20 @@ describe('WhoWhenSection — precision controls', () => {
it('renders a labelled precision select', async () => { it('renders a labelled precision select', async () => {
render(WhoWhenSection, {}); render(WhoWhenSection, {});
const label = document.querySelector('label[for="metaDatePrecision"]'); const label = document.querySelector('label[for="documentDatePrecision"]');
const select = document.querySelector('select#metaDatePrecision[name="metaDatePrecision"]'); const select = document.querySelector('select#documentDatePrecision[name="metaDatePrecision"]');
expect(label).not.toBeNull(); expect(label).not.toBeNull();
expect(select).not.toBeNull(); expect(select).not.toBeNull();
}); });
it('hides the end-date field unless precision is RANGE', async () => { it('hides the end-date field unless precision is RANGE', async () => {
render(WhoWhenSection, { precision: 'DAY' }); render(WhoWhenSection, { precision: 'DAY' });
expect(document.querySelector('input#metaDateEnd')).toBeNull(); expect(document.querySelector('input#documentDateEnd')).toBeNull();
}); });
it('reveals the end-date field when precision is RANGE', async () => { it('reveals the end-date field when precision is RANGE', async () => {
render(WhoWhenSection, { precision: 'RANGE' }); render(WhoWhenSection, { precision: 'RANGE' });
expect(document.querySelector('input#metaDateEnd')).not.toBeNull(); expect(document.querySelector('input#documentDateEnd')).not.toBeNull();
}); });
it('never renders the raw cell, and never re-submits it via a hidden input', async () => { it('never renders the raw cell, and never re-submits it via a hidden input', async () => {
@@ -110,9 +110,9 @@ describe('WhoWhenSection — end-before-start inline validation (#678)', () => {
endDateIso: '1917-01-10' endDateIso: '1917-01-10'
}); });
const end = document.querySelector('input#metaDateEnd') as HTMLInputElement; const end = document.querySelector('input#documentDateEnd') as HTMLInputElement;
await vi.waitFor(() => { await vi.waitFor(() => {
expect(document.querySelector('#end-date-error')).not.toBeNull(); expect(document.querySelector('#documentDate-end-error')).not.toBeNull();
expect(end.getAttribute('aria-invalid')).toBe('true'); expect(end.getAttribute('aria-invalid')).toBe('true');
expect(end.className).toContain('border-red-400'); expect(end.className).toContain('border-red-400');
}); });
@@ -125,14 +125,16 @@ describe('WhoWhenSection — end-before-start inline validation (#678)', () => {
endDateIso: '1917-01-10' endDateIso: '1917-01-10'
}); });
await vi.waitFor(() => expect(document.querySelector('#end-date-error')).not.toBeNull()); await vi.waitFor(() =>
expect(document.querySelector('#documentDate-end-error')).not.toBeNull()
);
const end = document.querySelector('input#metaDateEnd') as HTMLInputElement; const end = document.querySelector('input#documentDateEnd') as HTMLInputElement;
end.value = '12.01.1917'; // now after the start end.value = '12.01.1917'; // now after the start
end.dispatchEvent(new Event('input', { bubbles: true })); end.dispatchEvent(new Event('input', { bubbles: true }));
await vi.waitFor(() => { await vi.waitFor(() => {
expect(document.querySelector('#end-date-error')).toBeNull(); expect(document.querySelector('#documentDate-end-error')).toBeNull();
expect(end.getAttribute('aria-invalid')).not.toBe('true'); expect(end.getAttribute('aria-invalid')).not.toBe('true');
}); });
}); });
@@ -144,6 +146,6 @@ describe('WhoWhenSection — end-before-start inline validation (#678)', () => {
endDateIso: '1917-01-10' endDateIso: '1917-01-10'
}); });
expect(document.querySelector('#end-date-error')).toBeNull(); expect(document.querySelector('#documentDate-end-error')).toBeNull();
}); });
}); });