From 8db6ca60247373cf132692c11c8a87a9e7ae85c5 Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Sat, 9 May 2026 03:43:03 +0200 Subject: [PATCH] test(timetable): AddPerformanceDialog validation + submit (Step 8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 4 component tests via mountWithVuexy: - happy path: valid form values → POST /performances called with the correct body shape (engagement_id, event_id mapped from dayId, stage_id, start_at, end_at) - end_at < start_at → submit blocked, schema-level error visible on the end_at field - empty engagement_id → submit blocked, error visible on the engagement_id field - cancel button → emits update:modelValue=false Test seam: AddPerformanceDialog.vue gains `defineExpose({ form, errors, submit })` so jsdom tests can drive validation deterministically without piping through Flatpickr / VAutocomplete plumbing. Three lines, exposes internal refs only — no behavioural change. VDialog stubbed in the test (it teleports to body, which puts content outside the wrapper); App* wrappers stubbed (we test the schema + submit pipeline, not Flatpickr ergonomics). Test count: 360 → 364. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../timetable/AddPerformanceDialog.vue | 5 + .../component/AddPerformanceDialog.test.ts | 206 ++++++++++++++++++ 2 files changed, 211 insertions(+) create mode 100644 apps/app/tests/component/AddPerformanceDialog.test.ts diff --git a/apps/app/src/components/timetable/AddPerformanceDialog.vue b/apps/app/src/components/timetable/AddPerformanceDialog.vue index 84c0b1de..a1e3d2a4 100644 --- a/apps/app/src/components/timetable/AddPerformanceDialog.vue +++ b/apps/app/src/components/timetable/AddPerformanceDialog.vue @@ -96,6 +96,11 @@ async function submit(): Promise { errors.value._ = (err as Error).message ?? 'Onbekende fout' } } + +// Test seam (Session 4 follow-up): expose form + errors + submit so jsdom +// component tests can drive validation deterministically without piping +// through Flatpickr / VAutocomplete plumbing. +defineExpose({ form, errors, submit })