Keep listed published rules public and guest-claim rules unlisted, with semantic document markup and share chrome that stays clickable.
Guest publishes remain share-by-link but stay out of the catalog and sitemap, and their pages send noindex until claimed. The published-rule view now uses heading and list markup matching Markdown export, and top banners sit below the header so Share is not covered. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
77b0ec8ad8
commit
1445cb7e1e
27 files changed
+524
-86
No files matched your search
@@ -72,4 +72,41 @@ describe("CommunityRule", () => {
|
||||
expect(screen.getByText("Quorum")).toBeInTheDocument();
|
||||
expect(screen.getByText("60%")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("exposes category, entry, and block labels as headings and entries as a list", () => {
|
||||
render(
|
||||
<CommunityRule
|
||||
sections={[
|
||||
{
|
||||
categoryName: "Membership",
|
||||
entries: [
|
||||
{
|
||||
title: "Joining",
|
||||
body: "Ask existing members.",
|
||||
},
|
||||
{
|
||||
title: "Leaving",
|
||||
body: "Give two weeks notice.",
|
||||
blocks: [{ label: "Notice", body: "Written." }],
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 2, name: "Membership" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 3, name: "Joining" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 3, name: "Leaving" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 4, name: "Notice" }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getAllByRole("list").length).toBeGreaterThanOrEqual(1);
|
||||
expect(screen.getAllByRole("listitem")).toHaveLength(3);
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import {
|
||||
componentTestSuite,
|
||||
type ComponentTestSuiteConfig,
|
||||
@@ -15,7 +16,10 @@ const config: ComponentTestSuiteConfig<Props> = {
|
||||
categoryName: "Decision making",
|
||||
showRail: true,
|
||||
children: (
|
||||
<TextBlock title="How proposals pass" body="Important decisions require alignment." />
|
||||
<TextBlock
|
||||
title="How proposals pass"
|
||||
body="Important decisions require alignment."
|
||||
/>
|
||||
),
|
||||
} as Props,
|
||||
requiredProps: ["categoryName", "children"],
|
||||
@@ -27,4 +31,21 @@ const config: ComponentTestSuiteConfig<Props> = {
|
||||
|
||||
describe("Section", () => {
|
||||
componentTestSuite<Props>(config);
|
||||
|
||||
it("renders the category as a level-2 heading inside a section", () => {
|
||||
render(
|
||||
<Section categoryName="Decision making">
|
||||
<TextBlock
|
||||
title="How proposals pass"
|
||||
body="Important decisions require alignment."
|
||||
/>
|
||||
</Section>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 2, name: "Decision making" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 3, name: "How proposals pass" }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -58,4 +58,24 @@ describe("TextBlock", () => {
|
||||
expect(screen.getByText("Quorum")).toBeInTheDocument();
|
||||
expect(screen.getByText("60%")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders the title as a level-3 heading and labeled rows as a list", () => {
|
||||
render(
|
||||
<TextBlock
|
||||
title="Forum proposals"
|
||||
body="Anyone can start a thread."
|
||||
rows={[
|
||||
{ label: "Quorum", body: "60%" },
|
||||
{ label: "Threshold", body: "75%" },
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 3, name: "Forum proposals" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 4, name: "Quorum" }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getAllByRole("listitem")).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user