Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 2m54s
CI / OCR Service Tests (pull_request) Successful in 39s
CI / Backend Unit Tests (pull_request) Failing after 2m56s
CI / Unit & Component Tests (push) Failing after 3m6s
CI / Backend Unit Tests (push) Failing after 2m56s
CI / OCR Service Tests (push) Successful in 34s
Felix C2 — `BatchMetadataRequest` controller now uses `@Valid` so future @Size/etc. annotations on the record actually fire. Felix C3 — Auto-clear `$effect` in `+layout.svelte` reads `bulkSelectionStore.size` inside `untrack()` so the effect only re-fires on route change, not on every checkbox toggle. Felix C4 — `BulkDocumentEditLayout` edit-mode hydration loop now lives inside `onMount` (not at top-level script) so the SvelteMap mutation is unambiguously tied to instance lifecycle, matching the pattern used by `WhoWhenSection`/`DescriptionSection` after the cycle-2 fix. Felix C5 — Replaced fully-qualified `java.util.LinkedHashSet` in `DocumentController` with a top-of-file import. Sara coverage — six new spec files / blocks pin the cycle-1 and cycle-2 behaviours that were previously untested: - `WhoWhenSection.svelte.spec.ts` — onMount seeding from initialDateIso / initialLocation; doesn't stomp parent-bound dateIso; hideDate / editMode branch - `DescriptionSection.svelte.spec.ts` — onMount seeding from initialTitle / initialDocumentLocation; doesn't stomp parent-bound values; archive-box / archive-folder fields visible only in editMode - `BulkSelectionBar.svelte.spec.ts` — Esc-scope guard tests for `<dialog>` open and `aria-expanded` popover present - `BulkDocumentEditLayout.svelte.spec.ts` — topbar reads "Massenbearbeitung" + "werden bearbeitet" in edit mode (not the upload-flavoured "hochladen"/"werden erstellt" copy) - `DocumentControllerTest.patchBulk_returns400_whenArchiveBoxExceeds255Chars` — pins the @Size validator on archiveBox via the @Valid wiring Refs #225, PR #331 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.9 KiB
TypeScript
43 lines
1.9 KiB
TypeScript
import { afterEach, describe, expect, it } from 'vitest';
|
|
import { cleanup, render } from 'vitest-browser-svelte';
|
|
import { page } from 'vitest/browser';
|
|
import WhoWhenSection from './WhoWhenSection.svelte';
|
|
|
|
afterEach(() => cleanup());
|
|
|
|
describe('WhoWhenSection — onMount seeding (Felix B1 fix regression fence)', () => {
|
|
it('pre-fills the date input from initialDateIso when the bindable is empty', async () => {
|
|
render(WhoWhenSection, { initialDateIso: '2024-03-15' });
|
|
// isoToGerman('2024-03-15') → '15.03.2024'
|
|
const dateInput = document.querySelector('input#documentDate') as HTMLInputElement;
|
|
expect(dateInput).not.toBeNull();
|
|
expect(dateInput.value).toBe('15.03.2024');
|
|
});
|
|
|
|
it('does not stomp a parent-bound dateIso that is already non-empty', async () => {
|
|
// dateIso bindable is '2026-01-01' from the parent; initialDateIso is the
|
|
// "fallback seed". onMount must not overwrite the already-bound value.
|
|
render(WhoWhenSection, { dateIso: '2026-01-01', initialDateIso: '1900-01-01' });
|
|
const dateInput = document.querySelector('input#documentDate') as HTMLInputElement;
|
|
expect(dateInput.value).toBe('01.01.2026');
|
|
});
|
|
|
|
it('hides the date field when hideDate=true (bulk-edit mode)', async () => {
|
|
render(WhoWhenSection, { hideDate: true });
|
|
await expect.element(page.getByTestId('who-when-date')).not.toBeInTheDocument();
|
|
});
|
|
|
|
it('renders the meta_location input only outside editMode', async () => {
|
|
const { rerender } = render(WhoWhenSection, { editMode: true });
|
|
expect(document.querySelector('input#location')).toBeNull();
|
|
await rerender({ editMode: false });
|
|
expect(document.querySelector('input#location')).not.toBeNull();
|
|
});
|
|
|
|
it('pre-fills the location input from initialLocation', async () => {
|
|
render(WhoWhenSection, { editMode: false, initialLocation: 'Berlin' });
|
|
const locationInput = document.querySelector('input#location') as HTMLInputElement;
|
|
expect(locationInput.value).toBe('Berlin');
|
|
});
|
|
});
|