Link every Home feature card to the page that covers it, and keep Ask an organizer from adding a second heading.
This commit is contained in:
1 parent
d3acd9aa9a
commit
dc9625c3b2
9 files changed
+119
-49
No files matched your search
@@ -47,9 +47,12 @@ describe("AskOrganizer (behavioral tests)", () => {
|
||||
|
||||
it("renders subtitle when provided", () => {
|
||||
render(<AskOrganizer title="Test" subtitle="Subtitle" />);
|
||||
const subtitle = screen.getByText("Subtitle");
|
||||
expect(subtitle).toBeInTheDocument();
|
||||
expect(subtitle.tagName).toBe("P");
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "Subtitle" }),
|
||||
).toBeInTheDocument();
|
||||
screen.queryByRole("heading", { name: "Subtitle" }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders CTA button with default label", () => {
|
||||
|
||||
@@ -47,16 +47,11 @@ describe("FeatureGrid (behavioral tests)", () => {
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("links the two features that have pages and leaves the others as tiles", () => {
|
||||
it("links each feature card to the page that covers it", () => {
|
||||
render(<FeatureGrid title="Test" subtitle="Test" />);
|
||||
expect(screen.getByText("Choose how you decide")).toBeInTheDocument();
|
||||
expect(screen.getByText("Plan for conflict")).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("link", { name: /Choose how you decide/ }),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByRole("link", { name: /Plan for conflict/ }),
|
||||
).not.toBeInTheDocument();
|
||||
screen.getByRole("link", { name: /Choose how you decide/ }),
|
||||
).toHaveAttribute("href", "/blog/making-decisions-without-hierarchy");
|
||||
expect(
|
||||
screen.getByRole("link", { name: /Name your values/ }),
|
||||
).toHaveAttribute("href", "/how-it-works");
|
||||
@@ -66,6 +61,9 @@ describe("FeatureGrid (behavioral tests)", () => {
|
||||
"href",
|
||||
"/blog/integrating-new-members-without-dilution",
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("link", { name: /Plan for conflict/ }),
|
||||
).toHaveAttribute("href", "/blog/resolving-active-conflicts");
|
||||
});
|
||||
|
||||
it("sends Explore the patterns to the templates page", () => {
|
||||
@@ -96,25 +94,17 @@ describe("FeatureGrid (behavioral tests)", () => {
|
||||
it("uses Figma invert surface colors on feature cards", () => {
|
||||
render(<FeatureGrid title="Test" subtitle="Test" />);
|
||||
expect(
|
||||
document.querySelector(
|
||||
'[class*="bg-[var(--color-surface-invert-brand-lavender)]"]',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
screen.getByRole("link", { name: /Choose how you decide/ }).className,
|
||||
).toContain("brand-lavender");
|
||||
expect(
|
||||
document.querySelector(
|
||||
'[class*="bg-[var(--color-surface-invert-brand-lime)]"]',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
screen.getByRole("link", { name: /Name your values/ }).className,
|
||||
).toContain("brand-lime");
|
||||
expect(
|
||||
document.querySelector(
|
||||
'[class*="bg-[var(--color-surface-invert-brand-rust)]"]',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
screen.getByRole("link", { name: /Define membership/ }).className,
|
||||
).toContain("brand-teal");
|
||||
expect(
|
||||
document.querySelector(
|
||||
'[class*="bg-[var(--color-surface-invert-brand-teal)]"]',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
screen.getByRole("link", { name: /Plan for conflict/ }).className,
|
||||
).toContain("brand-red");
|
||||
});
|
||||
|
||||
it("marks the content block with the Figma node id", () => {
|
||||
|
||||
@@ -84,6 +84,29 @@ describe("ContentLockup", () => {
|
||||
expect(link.className).toMatch(/focus-visible:outline/);
|
||||
});
|
||||
|
||||
it("renders the ask subtitle as a paragraph, not a heading", () => {
|
||||
renderWithProviders(
|
||||
<ContentLockup
|
||||
variant="ask"
|
||||
headingLevel="h2"
|
||||
title="Still have questions?"
|
||||
subtitle="Get answers from an experienced organizer"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "Still have questions?" }).tagName,
|
||||
).toBe("H2");
|
||||
expect(
|
||||
screen.queryByRole("heading", {
|
||||
name: "Get answers from an experienced organizer",
|
||||
}),
|
||||
).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText("Get answers from an experienced organizer").tagName,
|
||||
).toBe("P");
|
||||
});
|
||||
|
||||
it("renders the title as h2 when headingLevel is h2", () => {
|
||||
renderWithProviders(
|
||||
<ContentLockup
|
||||
|
||||
@@ -59,13 +59,7 @@ test.describe("Critical User Journeys", () => {
|
||||
];
|
||||
|
||||
for (const feature of features) {
|
||||
const featureElement = page.locator(`text=${feature}`);
|
||||
if (
|
||||
(await featureElement.count()) > 0 &&
|
||||
(await featureElement.first().isVisible())
|
||||
) {
|
||||
await featureElement.first().click();
|
||||
}
|
||||
await expect(page.getByText(feature).first()).toBeVisible();
|
||||
}
|
||||
|
||||
// 8. User reads testimonial
|
||||
@@ -134,16 +128,16 @@ test.describe("Critical User Journeys", () => {
|
||||
).toHaveCount(0);
|
||||
await expect(
|
||||
featureSection.getByRole("link", { name: "Choose how you decide" }),
|
||||
).toHaveCount(0);
|
||||
await expect(
|
||||
featureSection.getByRole("link", { name: "Plan for conflict" }),
|
||||
).toHaveCount(0);
|
||||
).toHaveAttribute("href", "/blog/making-decisions-without-hierarchy");
|
||||
await expect(
|
||||
featureSection.getByRole("link", { name: "Name your values" }),
|
||||
).toHaveAttribute("href", "/how-it-works");
|
||||
await expect(
|
||||
featureSection.getByRole("link", { name: "Define membership" }),
|
||||
).toHaveAttribute("href", "/blog/integrating-new-members-without-dilution");
|
||||
await expect(
|
||||
featureSection.getByRole("link", { name: "Plan for conflict" }),
|
||||
).toHaveAttribute("href", "/blog/resolving-active-conflicts");
|
||||
await expect(
|
||||
featureSection.getByRole("link", { name: "Explore the patterns" }),
|
||||
).toHaveAttribute("href", "/templates");
|
||||
|
||||
@@ -124,6 +124,53 @@ describe("Page", () => {
|
||||
name: "Explore the patterns",
|
||||
});
|
||||
expect(learnMore[0]).toHaveAttribute("href", "/templates");
|
||||
expect(
|
||||
screen.getByRole("link", { name: /Choose how you decide/ }),
|
||||
).toHaveAttribute("href", "/blog/making-decisions-without-hierarchy");
|
||||
expect(
|
||||
screen.getByRole("link", { name: /Name your values/ }),
|
||||
).toHaveAttribute("href", "/how-it-works");
|
||||
expect(
|
||||
screen.getByRole("link", { name: /Define membership/ }),
|
||||
).toHaveAttribute(
|
||||
"href",
|
||||
"/blog/integrating-new-members-without-dilution",
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("link", { name: /Plan for conflict/ }),
|
||||
).toHaveAttribute("href", "/blog/resolving-active-conflicts");
|
||||
});
|
||||
|
||||
test("keeps a single page heading and leaves Card Steps unlinked", async () => {
|
||||
render(<Page />);
|
||||
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 1, name: "Build structure" }),
|
||||
).toBeInTheDocument();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.getByRole("heading", {
|
||||
name: "Tools for the parts that get hard",
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(screen.getAllByRole("heading", { level: 1 })).toHaveLength(1);
|
||||
expect(
|
||||
screen.getByRole("heading", {
|
||||
level: 2,
|
||||
name: "Tools for the parts that get hard",
|
||||
}).tagName,
|
||||
).toBe("H2");
|
||||
expect(
|
||||
screen.getByRole("heading", { name: "Still have questions?" }).tagName,
|
||||
).toBe("H2");
|
||||
expect(
|
||||
screen.queryByRole("link", {
|
||||
name: /See what has worked for other communities/,
|
||||
}),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("renders ask organizer section with correct data", () => {
|
||||
|
||||
@@ -187,6 +187,7 @@ describe("Page Flow Integration", () => {
|
||||
|
||||
const headings = screen.getAllByRole("heading");
|
||||
expect(headings.length).toBeGreaterThan(4);
|
||||
expect(screen.getAllByRole("heading", { level: 1 })).toHaveLength(1);
|
||||
|
||||
const mainContent = screen.getByText(
|
||||
/Strong communities agree on four things early/,
|
||||
|
||||
Reference in new issue
Block a user