diff --git a/src/client/components/CustomForms.tsx b/src/client/components/CustomForms.tsx index 708a9b6..10c0e17 100644 --- a/src/client/components/CustomForms.tsx +++ b/src/client/components/CustomForms.tsx @@ -455,7 +455,11 @@ export function eventStillNeeded(s: { const needs: string[] = []; if (s.title.trim() === "") needs.push("a name"); if (s.startDate === "") needs.push("a start date"); - if ((s.datedWindow && s.endKnown && s.endDate === "") || s.delayNeedsEnd) { + if (s.delayNeedsEnd && !s.endKnown) { + // The end field is hidden behind "I don't know when it ends", so a bare + // "an end date" would ask for something not on screen. + needs.push("an end date (a wait counts from it) or another repeat"); + } else if ((s.datedWindow && s.endKnown && s.endDate === "") || s.delayNeedsEnd) { needs.push("an end date"); } if (s.needsCycle) needs.push("a cycle length"); diff --git a/test/form-examples.test.tsx b/test/form-examples.test.tsx index 2cb457c..d6b4877 100644 --- a/test/form-examples.test.tsx +++ b/test/form-examples.test.tsx @@ -259,7 +259,7 @@ describe("what an event still needs", () => { expect(eventStillNeeded({ ...base, endDate: "", endKnown: false })).toEqual([]); expect(eventStillNeeded({ ...base, endDate: "", datedWindow: false })).toEqual([]); expect(eventStillNeeded({ ...base, endKnown: false, delayNeedsEnd: true })).toEqual([ - "an end date", + "an end date (a wait counts from it) or another repeat", ]); expect(eventStillNeeded({ ...base, needsCycle: true })).toEqual(["a cycle length"]); }); @@ -338,3 +338,22 @@ describe("review fixes: Save never sits disabled without a reason", () => { expect(filled.needs).toEqual([]); }); }); + +describe("follow-up: a wait with the end set to unknown", () => { + test("names the way out instead of asking for a field it hides", () => { + const v: EventFormValues = { + ...blankEvent, + title: "x", + cadence: "custom", + repeatMode: "delay", + endKnown: false, + startDate: "2026-10-01", + endDate: "", + }; + expect(eventFormState(v, null).needs).toEqual([ + "an end date (a wait counts from it) or another repeat", + ]); + // With the end field on screen, the plain words are enough. + expect(eventFormState({ ...v, endKnown: true }, null).needs).toEqual(["an end date"]); + }); +});