Issue #59 fixes

This commit is contained in:
adilallo
2026-05-25 22:05:00 -06:00
parent bd536a407f
commit 6b45a2e5d0
39 changed files with 167 additions and 124 deletions
+5 -2
View File
@@ -54,7 +54,10 @@ describe("Footer (behavioral tests)", () => {
screen.getAllByRole("link", { name: "Follow us on Bluesky" }).length,
).toBeGreaterThan(0);
expect(
screen.getAllByRole("link", { name: "Follow us on GitLab" }).length,
screen.getAllByRole("link", { name: "View source on Gitea" }).length,
).toBeGreaterThan(0);
expect(
screen.getAllByRole("link", { name: "Follow us on Mastodon" }).length,
).toBeGreaterThan(0);
});
@@ -74,7 +77,7 @@ describe("Footer (behavioral tests)", () => {
it("renders navigation links with baseline width-fit focus targets", () => {
render(<Footer />);
const useCases = screen.getAllByRole("link", { name: "Use cases" })[0];
expect(useCases).toHaveClass("w-fit", "self-start");
expect(useCases).toHaveClass("w-fit", "self-start", "md:self-end");
expect(useCases).not.toHaveClass("w-full");
});
+3 -3
View File
@@ -12,7 +12,7 @@ type IconProps = React.ComponentProps<typeof Icon>;
const baseProps: IconProps = {
icon: <div data-testid="test-icon">Icon</div>,
title: "Worker's cooperatives",
title: "Worker cooperatives",
description:
"Employee-owned businesses often need to clarify how power is shared",
};
@@ -89,12 +89,12 @@ describe("Icon (behavioral tests)", () => {
render(
<Icon
icon={<div data-testid="icon">Icon</div>}
title="Worker's cooperatives"
title="Worker cooperatives"
description="Employee-owned businesses"
/>,
);
expect(screen.getByTestId("icon")).toBeInTheDocument();
expect(screen.getByText("Worker's cooperatives")).toBeInTheDocument();
expect(screen.getByText("Worker cooperatives")).toBeInTheDocument();
expect(screen.getByText("Employee-owned businesses")).toBeInTheDocument();
});
+24
View File
@@ -166,6 +166,30 @@ describe("MultiSelect behaviour specifics", () => {
expect(handleConfirm).toHaveBeenCalledWith("custom-1", "NewOption");
});
it("allows spaces in custom chip labels", async () => {
const handleConfirm = vi.fn();
const customOptions = [
{ id: "custom-1", label: "", state: "custom" as const },
];
render(
<MultiSelect
options={customOptions}
onCustomChipConfirm={handleConfirm}
/>,
);
const input = screen.getByPlaceholderText("Type to add");
await userEvent.type(input, "Mutual aid network");
const checkButton = screen.getByRole("button", { name: "Confirm" });
await userEvent.click(checkButton);
expect(handleConfirm).toHaveBeenCalledWith(
"custom-1",
"Mutual aid network",
);
});
it("handles custom chip close", async () => {
const handleClose = vi.fn();
const customOptions = [
+1 -3
View File
@@ -101,9 +101,7 @@ test.describe("Critical User Journeys", () => {
// Check key components are rendered
await expect(page.locator('img[alt="Hero illustration"]')).toBeVisible();
await expect(
page.locator("text=Trusted by leading cooperators"),
).toBeVisible();
await expect(page.locator('img[alt="Food Not Bombs"]')).toBeVisible();
await expect(page.locator("text=Jo Freeman")).toBeVisible();
});
+2 -2
View File
@@ -31,7 +31,7 @@ const mockPosts = [
frontmatter: {
title: "Resolving Active Conflicts",
description: "Practical steps for resolving conflicts",
author: "Author name",
author: "CommunityRule",
date: "2025-04-15",
thumbnail: {
vertical: "resolving-active-conflicts-vertical.svg",
@@ -48,7 +48,7 @@ const mockPosts = [
frontmatter: {
title: "Operational Security for Mutual Aid",
description: "Tactics to protect members",
author: "Author name",
author: "CommunityRule",
date: "2025-04-10",
thumbnail: {
vertical: "operational-security-mutual-aid-vertical.svg",
+11 -5
View File
@@ -134,12 +134,16 @@ describe("User Journey Integration", () => {
const blueskyLink = screen.getByRole("link", {
name: "Follow us on Bluesky",
});
const gitlabLink = screen.getByRole("link", {
name: "Follow us on GitLab",
const giteaLink = screen.getByRole("link", {
name: "View source on Gitea",
});
const mastodonLink = screen.getByRole("link", {
name: "Follow us on Mastodon",
});
expect(blueskyLink).toBeInTheDocument();
expect(gitlabLink).toBeInTheDocument();
expect(giteaLink).toBeInTheDocument();
expect(mastodonLink).toBeInTheDocument();
});
test("user explores features and benefits", async () => {
@@ -179,9 +183,11 @@ describe("User Journey Integration", () => {
});
const blueskyLink = screen.getByRole("link", { name: /Bluesky/i });
const gitlabLink = screen.getByRole("link", { name: /GitLab/i });
const giteaLink = screen.getByRole("link", { name: /Gitea/i });
const mastodonLink = screen.getByRole("link", { name: /Mastodon/i });
expect(blueskyLink).toBeInTheDocument();
expect(gitlabLink).toBeInTheDocument();
expect(giteaLink).toBeInTheDocument();
expect(mastodonLink).toBeInTheDocument();
});
test("user completes the full journey from discovery to action", async () => {
+7 -21
View File
@@ -42,14 +42,6 @@ describe("LogoWall Component", () => {
expect(screen.queryByAltText("Food Not Bombs")).not.toBeInTheDocument();
});
test("renders section label", () => {
render(<LogoWall />);
expect(
screen.getByText("Trusted by leading cooperators"),
).toBeInTheDocument();
});
test("applies correct CSS classes", () => {
render(<LogoWall />);
@@ -74,7 +66,12 @@ describe("LogoWall Component", () => {
'[class*="grid grid-cols-2 grid-rows-3"]',
);
expect(grid).toBeInTheDocument();
expect(grid).toHaveClass("sm:grid-cols-3", "sm:grid-rows-2", "md:flex");
expect(grid).toHaveClass(
"sm:grid-cols-3",
"sm:grid-rows-2",
"md:flex",
"md:justify-center",
);
});
test("renders logos with correct attributes", () => {
@@ -88,15 +85,6 @@ describe("LogoWall Component", () => {
expect(foodNotBombsLogo).toHaveClass("h-11", "lg:h-14", "xl:h-[70px]");
});
test("applies order classes for responsive layout", () => {
render(<LogoWall />);
const foodNotBombsContainer = screen
.getByAltText("Food Not Bombs")
.closest("div");
expect(foodNotBombsContainer).toHaveClass("order-1", "sm:order-4");
});
test("handles empty logos array", () => {
render(<LogoWall logos={[]} />);
@@ -119,9 +107,7 @@ describe("LogoWall Component", () => {
const section = document.querySelector("section");
expect(section).toBeInTheDocument();
// Check for the label
const label = screen.getByText("Trusted by leading cooperators");
expect(label).toBeInTheDocument();
expect(screen.queryByText("Trusted by leading cooperators")).not.toBeInTheDocument();
});
test("applies transition effects", () => {