Fix case-study share chrome, hero lockup width, and copy confirmation in the share dialog.
Marketing pages omitted create-flow nav copy, so Share rendered as a translation key; the case-study banner squeezed hero text to the thumbnail width; Copy link had no hover or copied state. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -70,6 +70,43 @@ describe("Share modal", () => {
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("confirms Copy link with Copied! when the handler succeeds", async () => {
|
||||
const user = userEvent.setup();
|
||||
const onCopyLink = vi.fn().mockResolvedValue(true);
|
||||
render(
|
||||
<Share
|
||||
isOpen={true}
|
||||
onClose={vi.fn()}
|
||||
{...noopHandlers}
|
||||
onCopyLink={onCopyLink}
|
||||
/>,
|
||||
);
|
||||
await user.click(screen.getByRole("button", { name: "Copy link" }));
|
||||
expect(onCopyLink).toHaveBeenCalledTimes(1);
|
||||
expect(screen.getByRole("button", { name: "Copied!" })).toHaveAttribute(
|
||||
"aria-pressed",
|
||||
"true",
|
||||
);
|
||||
expect(screen.getByText("Link copied to clipboard")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("keeps Copy link when the handler reports failure", async () => {
|
||||
const user = userEvent.setup();
|
||||
render(
|
||||
<Share
|
||||
isOpen={true}
|
||||
onClose={vi.fn()}
|
||||
{...noopHandlers}
|
||||
onCopyLink={vi.fn().mockResolvedValue(false)}
|
||||
/>,
|
||||
);
|
||||
await user.click(screen.getByRole("button", { name: "Copy link" }));
|
||||
expect(screen.getByRole("button", { name: "Copy link" })).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "Copied!" }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("calls onClose when header overflow (more) is activated, matching modal chrome parity", async () => {
|
||||
const user = userEvent.setup();
|
||||
const onClose = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user