Give every public route its own description, and keep canonicals and structured data on the host that serves the page.
Decorative images on the marketing pages stay quiet, and every dialog close button is named Close. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0b6e8b00dd
commit
c180e79c38
52 files changed
+363
-209
No files matched your search
@@ -36,7 +36,7 @@ describe("Alert dismiss control", () => {
|
||||
it("omits close button when onClose is absent", () => {
|
||||
render(<Alert title="T" description="D" />);
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "Close alert" }),
|
||||
screen.queryByRole("button", { name: "Close" }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ describe("Alert dismiss control", () => {
|
||||
const user = userEvent.setup();
|
||||
const onClose = vi.fn();
|
||||
render(<Alert title="T" onClose={onClose} />);
|
||||
await user.click(screen.getByRole("button", { name: "Close alert" }));
|
||||
await user.click(screen.getByRole("button", { name: "Close" }));
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ describe("Alert dismiss control", () => {
|
||||
<Alert title="T" onClose={onClose} hasTrailingIcon={false} />,
|
||||
);
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "Close alert" }),
|
||||
screen.queryByRole("button", { name: "Close" }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -32,7 +32,7 @@ describe("ConfirmStakeholdersScreen", () => {
|
||||
expect(
|
||||
screen.getByText(/Congratulations! You've drafted your CommunityRule!/i),
|
||||
).toBeInTheDocument();
|
||||
await user.click(screen.getByRole("button", { name: "Close alert" }));
|
||||
await user.click(screen.getByRole("button", { name: "Close" }));
|
||||
expect(
|
||||
screen.queryByText(
|
||||
/Congratulations! You've drafted your CommunityRule!/i,
|
||||
|
||||
@@ -55,7 +55,7 @@ describe("Create", () => {
|
||||
it("calls onClose when close button is clicked", () => {
|
||||
const onClose = vi.fn();
|
||||
renderWithProviders(<Create {...defaultProps} onClose={onClose} />);
|
||||
const closeButton = screen.getByLabelText("Close dialog");
|
||||
const closeButton = screen.getByLabelText("Close");
|
||||
fireEvent.click(closeButton);
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -269,7 +269,7 @@ describe("Create", () => {
|
||||
</Create>,
|
||||
);
|
||||
|
||||
const closeButton = screen.getByLabelText("Close dialog");
|
||||
const closeButton = screen.getByLabelText("Close");
|
||||
screen.getByLabelText("Test Input"); // Verify input is rendered
|
||||
|
||||
// Focus should start on first focusable element (close button)
|
||||
|
||||
@@ -114,7 +114,7 @@ describe("Dialog", () => {
|
||||
it("calls onClose when close control is activated", () => {
|
||||
const onClose = vi.fn();
|
||||
renderWithProviders(<Dialog {...defaultProps} onClose={onClose} />);
|
||||
fireEvent.click(screen.getByLabelText("Close dialog"));
|
||||
fireEvent.click(screen.getByLabelText("Close"));
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -440,9 +440,9 @@ describe("FinalReviewScreen — chip detail modal", () => {
|
||||
expect(
|
||||
within(dialog).getByRole("button", { name: "Save" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
within(dialog).queryByRole("button", { name: "Close" }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(within(dialog).getAllByRole("button", { name: "Close" })).toHaveLength(
|
||||
1,
|
||||
);
|
||||
});
|
||||
|
||||
it("opens Save for a values chip (use-without-changes seeded snapshot)", async () => {
|
||||
@@ -579,7 +579,7 @@ describe("FinalReviewScreen — chip detail modal", () => {
|
||||
expect(
|
||||
within(dialog).queryByRole("button", { name: "Back" }),
|
||||
).not.toBeInTheDocument();
|
||||
fireEvent.click(within(dialog).getByLabelText("Close dialog"));
|
||||
fireEvent.click(within(dialog).getByLabelText("Close"));
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ describe("Login", () => {
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
||||
});
|
||||
fireEvent.click(screen.getByLabelText("Close dialog"));
|
||||
fireEvent.click(screen.getByLabelText("Close"));
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@@ -169,7 +169,7 @@ describe("Login", () => {
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.getByLabelText("Close dialog")).toBeInTheDocument();
|
||||
expect(screen.getByLabelText("Close")).toBeInTheDocument();
|
||||
expect(screen.queryByLabelText("More options")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -31,14 +31,14 @@ componentTestSuite<LogoProps>(config);
|
||||
describe("Logo (behavioral tests)", () => {
|
||||
it("renders as a link to home", () => {
|
||||
render(<Logo />);
|
||||
const logo = screen.getByRole("link", { name: /communityrule logo/i });
|
||||
const logo = screen.getByRole("link", { name: "CommunityRule" });
|
||||
expect(logo).toHaveAttribute("href", "/");
|
||||
expect(logo).toHaveAttribute("aria-label", "CommunityRule Logo");
|
||||
expect(logo).toHaveAttribute("aria-label", "CommunityRule");
|
||||
});
|
||||
|
||||
it("animates the mark on hover without scaling the wordmark", () => {
|
||||
render(<Logo />);
|
||||
const logo = screen.getByRole("link", { name: /communityrule logo/i });
|
||||
const logo = screen.getByRole("link", { name: "CommunityRule" });
|
||||
const wordmark = screen.getByText("CommunityRule");
|
||||
const mark = logo.querySelector("img");
|
||||
expect(logo).toHaveClass("group");
|
||||
@@ -48,7 +48,7 @@ describe("Logo (behavioral tests)", () => {
|
||||
|
||||
it("renders logo icon", () => {
|
||||
render(<Logo />);
|
||||
expect(screen.getByAltText("CommunityRule Logo")).toBeInTheDocument();
|
||||
expect(screen.getByAltText("CommunityRule")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders text by default", () => {
|
||||
@@ -60,7 +60,7 @@ describe("Logo (behavioral tests)", () => {
|
||||
const { container } = render(<Logo wordmark={false} />);
|
||||
const textElement = container.querySelector(".hidden");
|
||||
expect(textElement).toBeInTheDocument();
|
||||
expect(screen.getByAltText("CommunityRule Logo")).toBeInTheDocument();
|
||||
expect(screen.getByAltText("CommunityRule")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("applies inverse palette styling when palette is inverse", () => {
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { render } from "@testing-library/react";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import SectionNumber from "../../app/components/sections/SectionNumber";
|
||||
|
||||
describe("SectionNumber", () => {
|
||||
it("rotates the shape and keeps the numeral upright", () => {
|
||||
render(<SectionNumber number={1} />);
|
||||
const { container } = render(<SectionNumber number={1} />);
|
||||
|
||||
const numeral = screen.getByText("1");
|
||||
const numeral = container.querySelector("span");
|
||||
expect(numeral).toHaveTextContent("1");
|
||||
expect(numeral).toHaveClass("text-large-label");
|
||||
expect(numeral.className).not.toMatch(/rotate/);
|
||||
expect(numeral?.className).not.toMatch(/rotate/);
|
||||
|
||||
const shape = screen.getByAltText("Section 1");
|
||||
const shape = container.querySelector("img");
|
||||
expect(shape).toHaveAttribute("alt", "");
|
||||
expect(shape).toHaveClass("rotate-15");
|
||||
expect(shape.parentElement).not.toHaveClass("rotate-15");
|
||||
expect(shape.parentElement?.className).not.toMatch(/-rotate-/);
|
||||
expect(shape?.parentElement).toHaveAttribute("aria-hidden", "true");
|
||||
expect(shape?.parentElement).not.toHaveClass("rotate-15");
|
||||
expect(shape?.parentElement?.className).not.toMatch(/-rotate-/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user