test(11-05): RED — WR-03 helper text suppressed for timed off-list 10080

- timed event with reminderLeadMinutes=10080 must show 'Custom reminder kept' helper
- currently suppressed: helper text checks !TIMED && !ALLDAY, but 10080 is in ALLDAY
- fix: gate helper text on active preset set only (allDay ? ALLDAY : TIMED)
This commit is contained in:
Lucas Berger
2026-06-14 08:24:01 -04:00
parent 7d94afb2d8
commit 401591374a
@@ -1327,3 +1327,72 @@ describe('EventForm — Phase 11 Plan 05 CR-01: custom alarm round-trip', () =>
});
});
});
// ─── Phase 11 Plan 05 WR-03: off-list option + helper text gate on active preset set ──────
// A timed event with reminderLeadMinutes=10080 is off-list for timed events (10080 is
// in ALLDAY_REMINDER_PRESETS but NOT TIMED_REMINDER_PRESETS). Before the fix the helper
// text condition checked BOTH sets: `!TIMED && !ALLDAY` — so 10080 was treated as "in
// presets" because it IS in ALLDAY, and helper text was suppressed.
// The fix: gate on only the active set (`allDay ? ALLDAY_REMINDER_PRESETS : TIMED_REMINDER_PRESETS`).
// WR-03 timed fixture: reminderLeadMinutes=10080, allDay=false
const TIMED_OFFLIST_10080_OCCURRENCE: CalendarOccurrence = {
id: 'offlist-10080-uid::2026-12-15T10:00:00',
uid: 'offlist-10080-uid',
calendarId: 1,
calendarName: 'My Calendar',
ownerUserId: 1,
ownerName: 'Alice',
color: '#4A90D9',
isShared: false,
title: 'Long-lead timed meeting',
start: '2026-12-15T10:00:00-05:00',
end: '2026-12-15T11:00:00-05:00',
allDay: false, // timed — 10080 is off-list
location: null,
description: null,
hasRrule: false,
reminderLeadMinutes: 10080, // 1 week — in ALLDAY presets but NOT TIMED presets
reminderIsCustom: false,
};
describe('EventForm — Phase 11 Plan 05 WR-03: off-list option + helper text gate on active preset set', () => {
beforeEach(() => {
vi.clearAllMocks();
mockEventFormOpen = true;
mockEventFormMode = 'create';
mockEventFormUid = null;
});
it('WR-03: timed event with reminderLeadMinutes=10080 shows synthetic off-list option', () => {
// 10080 is off-list for timed events — synthetic option must appear
renderForm({
mode: 'edit',
uid: 'offlist-10080-uid',
eventOccurrence: TIMED_OFFLIST_10080_OCCURRENCE,
});
const reminderSelect = document.querySelector('#event-reminder') as HTMLSelectElement;
expect(reminderSelect).not.toBeNull();
expect(reminderSelect.value).toBe('10080');
// The synthetic option text comes from humanizeReminderLead(10080) = '7 days before'
// (not one of the standard timed preset labels)
const selectedOption = reminderSelect.options[reminderSelect.selectedIndex];
expect(selectedOption).not.toBeNull();
expect(selectedOption.value).toBe('10080');
});
it('WR-03: timed event with reminderLeadMinutes=10080 shows helper text (not suppressed by allday preset membership)', () => {
// Before the fix: helper text uses `!TIMED && !ALLDAY` — since 10080 IS in ALLDAY,
// the condition is false → helper text hidden. After fix: only active (timed) set used.
renderForm({
mode: 'edit',
uid: 'offlist-10080-uid',
eventOccurrence: TIMED_OFFLIST_10080_OCCURRENCE,
});
// Helper text must be visible for a timed off-list value in edit mode
const helperText = screen.queryByText(/Custom reminder kept/i);
expect(helperText).not.toBeNull();
});
});