feat: save a quick event without a title as "(No title)"

This commit is contained in:
Linus Rath
2026-11-04 17:47:25 +01:00
parent 849a07345a
commit bc2da09be5
3 changed files with 24 additions and 5 deletions
@@ -595,6 +595,21 @@ describe('CalendarApp task feedback', () => {
});
});
describe('CalendarApp quick editor', () => {
// Usability report 2026-11-04: Save stayed off until a title was typed.
// Google Calendar saves "(No title)"; so does the quick editor now.
it('saves an event without a title as "(No title)"', async () => {
renderApp();
fireEvent.click(slots()[3]);
const quick = await screen.findByRole('dialog', { name: 'quick_create.aria_label' }, { timeout: 2000 });
const save = within(quick).getByRole('button', { name: 'form.save' });
expect(save).toBeEnabled();
fireEvent.click(save);
await waitFor(() => expect(store.createEvent).toHaveBeenCalledTimes(1));
expect(store.createEvent.mock.calls[0][1]).toMatchObject({ title: 'events.no_title', showWithoutTime: false });
});
});
describe('CalendarApp creating in the month view', () => {
it('opens the quick editor for an all-day event on a single click', async () => {
setUp([], 'month');
+7 -4
View File
@@ -1287,12 +1287,15 @@ export function CalendarApp({ linkSegments: routeSegments }: CalendarAppProps =
const handleQuickCreateSave = useCallback(async () => {
if (!quickDraft) return;
const { start, end, title, calendarId, allDay } = quickDraft;
const { start, end, calendarId, allDay } = quickDraft;
// Saving without a title is allowed, as in Google Calendar: the event
// is called "(No title)" in the user's language.
const title = quickDraft.title.trim() || t("events.no_title");
if (allDay) {
setQuickDraft(null);
await handleSaveEvent({
uid: generateUUID(),
title: title.trim(),
title,
start: format(start, "yyyy-MM-dd'T'00:00:00"),
duration: "P1D",
timeZone: null,
@@ -1313,7 +1316,7 @@ export function CalendarApp({ linkSegments: routeSegments }: CalendarAppProps =
// as the full editor's fields, so they are labelled with that zone.
await handleSaveEvent({
uid: generateUUID(),
title: title.trim(),
title,
start: format(start, "yyyy-MM-dd'T'HH:mm:ss"),
duration,
timeZone: getEffectiveTimeZone(),
@@ -1323,7 +1326,7 @@ export function CalendarApp({ linkSegments: routeSegments }: CalendarAppProps =
freeBusyStatus: "busy",
privacy: "public",
});
}, [quickDraft, handleSaveEvent]);
}, [quickDraft, handleSaveEvent, t]);
// While the quick editor is open its placeholder takes the preview slot.
const gridPreview = useMemo<PendingEventPreview | null>(() => {
+2 -1
View File
@@ -148,7 +148,8 @@ export function QuickCreatePopover({
};
}, [onClose]);
const canSave = draft.title.trim().length > 0 && !!draft.calendarId;
// An empty title saves as "(No title)", as in Google Calendar.
const canSave = !!draft.calendarId;
const handleSubmit = useCallback((e: React.FormEvent) => {
e.preventDefault();
if (canSave) onSave();