Rebuild Share and Delete Account from the privacy designs.
Share asks the person who holds the pen to confirm their community agreed before a link turns on, and deleting an account lists each owned Rule with PDF and RULE.md export. Case-study Share copies the page link instead of opening the privacy modal, and the sign-in banner stays below the header so Share remains clickable.
This commit is contained in:
1 parent
5cbda35e32
commit
b6795c1f18
28 files changed
+1467
-377
No files matched your search
@@ -61,6 +61,8 @@ function viewProps(
|
||||
onOpenDeleteAccount: vi.fn(),
|
||||
onCloseDeleteAccount: vi.fn(),
|
||||
onConfirmDeleteAccount: vi.fn(),
|
||||
onExportRulePdf: vi.fn(),
|
||||
onExportRuleMarkdown: vi.fn(),
|
||||
onDismissProfileSuccess: vi.fn(),
|
||||
onDismissActionError: vi.fn(),
|
||||
onDismissRulesError: vi.fn(),
|
||||
@@ -127,12 +129,13 @@ describe("ProfilePageView", () => {
|
||||
);
|
||||
|
||||
const dialog = screen.getByRole("dialog", {
|
||||
name: copy.deleteAccountModalTitle,
|
||||
name: messages.modals.deleteAccount.title,
|
||||
});
|
||||
expect(dialog).toHaveTextContent(copy.deleteAccountModalBody);
|
||||
expect(dialog).toHaveTextContent(messages.modals.deleteAccount.description);
|
||||
const confirm = within(dialog).getByRole("button", {
|
||||
name: copy.deleteAccountConfirm,
|
||||
name: messages.modals.deleteAccount.confirm,
|
||||
});
|
||||
expect(confirm).toBeDisabled();
|
||||
expect(confirm.className).toContain(
|
||||
"border-[var(--color-border-default-negative-primary)]",
|
||||
);
|
||||
@@ -140,6 +143,12 @@ describe("ProfilePageView", () => {
|
||||
"bg-[var(--color-surface-invert-primary)]",
|
||||
);
|
||||
|
||||
await user.click(
|
||||
within(dialog).getByRole("checkbox", {
|
||||
name: messages.modals.deleteAccount.confirmLabel,
|
||||
}),
|
||||
);
|
||||
expect(confirm).toBeEnabled();
|
||||
await user.click(confirm);
|
||||
expect(onConfirmDeleteAccount).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -118,6 +118,27 @@ describe("UseCaseCompletedRulePage", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("Share copies the page link through a banner instead of a privacy modal", async () => {
|
||||
const user = userEvent.setup();
|
||||
const writeText = vi.fn().mockResolvedValue(undefined);
|
||||
Object.defineProperty(window.navigator, "clipboard", {
|
||||
configurable: true,
|
||||
value: { writeText },
|
||||
});
|
||||
|
||||
render(
|
||||
await UseCaseCompletedRulePage({
|
||||
params: Promise.resolve({ slug: "food-not-bombs" }),
|
||||
}),
|
||||
);
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "Share" }));
|
||||
expect(writeText).toHaveBeenCalled();
|
||||
expect(screen.getByText("Link copied")).toBeInTheDocument();
|
||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
test("Share button reads Share under the marketing case-study bundle", async () => {
|
||||
rtlRender(
|
||||
<MessagesProvider messages={marketingMessages}>
|
||||
|
||||
Reference in new issue
Block a user