Place account deletion in its own danger row so it stays separate from routine options.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
72c51adbb3
commit
89f3e5684d
3 files changed
+38
-51
No files matched your search
@@ -69,34 +69,36 @@ function viewProps(
|
||||
}
|
||||
|
||||
describe("ProfilePageView", () => {
|
||||
test("keeps account deletion out of the routine options list", () => {
|
||||
test("puts delete account in its own danger area", () => {
|
||||
render(<ProfilePageView {...viewProps()} />);
|
||||
|
||||
const options = screen.getByRole("navigation", {
|
||||
name: copy.yourOptionsHeading,
|
||||
});
|
||||
const createRule = within(options).getByRole("button", {
|
||||
name: copy.optionCreateCustom,
|
||||
});
|
||||
expect(createRule.closest("ul")).not.toBeNull();
|
||||
expect(
|
||||
within(options).queryByRole("button", { name: copy.deleteAccountConfirm }),
|
||||
).not.toBeInTheDocument();
|
||||
within(options).getByRole("button", { name: copy.optionCreateCustom }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
within(options).queryByRole("heading", { name: copy.deleteAccount }),
|
||||
within(options).queryByRole("button", { name: copy.deleteAccount }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(copy.deleteAccountIntro)).not.toBeInTheDocument();
|
||||
|
||||
const danger = screen.getByRole("region", { name: copy.deleteAccount });
|
||||
expect(danger).toHaveTextContent(copy.deleteAccountIntro);
|
||||
const deleteAccount = within(danger).getByRole("button", {
|
||||
name: copy.deleteAccountConfirm,
|
||||
});
|
||||
expect(deleteAccount.closest("ul")).toBeNull();
|
||||
expect(deleteAccount.className).toContain(
|
||||
expect(danger.className).toContain(
|
||||
"border-[var(--color-border-default-negative-primary)]",
|
||||
);
|
||||
expect(deleteAccount.className).not.toContain(
|
||||
"bg-[var(--color-surface-inverse-primary)]",
|
||||
const deleteAccount = within(danger).getByRole("button", {
|
||||
name: copy.deleteAccount,
|
||||
});
|
||||
const deleteTitle = within(deleteAccount).getByText(copy.deleteAccount);
|
||||
expect(deleteTitle.className).toContain(
|
||||
"!text-[var(--color-content-default-negative-primary)]",
|
||||
);
|
||||
expect(deleteAccount.firstElementChild?.className).not.toContain(
|
||||
"negative-primary",
|
||||
);
|
||||
expect(deleteAccount.lastElementChild?.className).not.toContain(
|
||||
"negative-primary",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -109,7 +111,7 @@ describe("ProfilePageView", () => {
|
||||
);
|
||||
|
||||
await user.click(
|
||||
screen.getByRole("button", { name: copy.deleteAccountConfirm }),
|
||||
screen.getByRole("button", { name: copy.deleteAccount }),
|
||||
);
|
||||
expect(onOpenDeleteAccount).toHaveBeenCalledTimes(1);
|
||||
|
||||
|
||||
Reference in new issue
Block a user