test(timetable): AddPerformanceDialog validation + submit (Step 8)

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) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 03:43:03 +02:00
parent 1e7eba80a8
commit 8db6ca6024
2 changed files with 211 additions and 0 deletions

View File

@@ -96,6 +96,11 @@ async function submit(): Promise<void> {
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 })
</script>
<template>