Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,18 @@ describe("ScheduledTasksSettings", () => {
await expect.element(dialog.getByRole("heading", { name: "New task" })).toBeInTheDocument();
await expect.element(name).toHaveValue("My draft");
});

it("keeps a new task's draft when the user clicks outside the editor", async () => {
setup();
await using _screen = await render(<ScheduledTasksSettings />);
await userEvent.click(page.getByRole("button", { name: "New task" }));
const dialog = page.getByRole("dialog");
const name = dialog.getByRole("textbox", { name: "Name" });
await userEvent.fill(name, "My draft");

await userEvent.click(document.body, { position: { x: 1, y: 1 } });

await expect.element(dialog).toHaveAttribute("data-open");
await expect.element(name).toHaveValue("My draft");
});
});
2 changes: 2 additions & 0 deletions apps/web/src/components/settings/ScheduledTasksSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,8 @@ function ScheduledTaskEditorDialog({
return (
<Dialog
open
// A stray click outside would discard the unsaved draft; Escape and Cancel still close it.
disablePointerDismissal
Comment thread
Jardo-51 marked this conversation as resolved.
Resolved
onOpenChange={(open) => {
if (!open && !saving) onClose();
}}
Expand Down
Loading