Let guests keep a published rule via Save & Exit and a post-finalize sign-in prompt.
Email is optional so they can continue without saving; skip from Save & Exit leaves the flow instead of returning to completed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -110,6 +110,26 @@ describe("Login", () => {
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("closes on backdrop pointerdown, not a leftover click", async () => {
|
||||
const onClose = vi.fn();
|
||||
renderWithProviders(
|
||||
<Login isOpen onClose={onClose} ariaLabelledBy="login-modal-heading">
|
||||
<p id="login-modal-heading">Body</p>
|
||||
</Login>,
|
||||
);
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
||||
});
|
||||
const backdrop = screen.getByRole("dialog").parentElement;
|
||||
expect(backdrop).not.toBeNull();
|
||||
fireEvent.click(backdrop!);
|
||||
expect(onClose).not.toHaveBeenCalled();
|
||||
fireEvent.pointerDown(screen.getByRole("dialog"));
|
||||
expect(onClose).not.toHaveBeenCalled();
|
||||
fireEvent.pointerDown(backdrop!);
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("locks body scroll while open", async () => {
|
||||
renderWithProviders(
|
||||
<Login isOpen onClose={vi.fn()} ariaLabelledBy="login-modal-heading">
|
||||
|
||||
Reference in New Issue
Block a user