feat(polaris): 实现静态分类页

新增七个预生成分类路由、工具卡片网格与空状态。启用侧栏分类导航和当前分类选中态,修复 Windows 静态导出 RSC 路径并补充产物验证,保持静态导出与安全外链约束。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-15 19:24:57 +08:00
co-authored by Claude Opus 5
parent 26afe86e5a
commit d015a53a12
24 changed files with 2332 additions and 46 deletions
@@ -139,7 +139,7 @@ describe("AppShell", () => {
)
})
it("分类项可聚焦但保持禁用", () => {
it("首页默认选中并启用分类链接", () => {
render(
<AppShell
categories={categories}
@@ -150,13 +150,52 @@ describe("AppShell", () => {
</AppShell>,
)
expect(
screen.getByRole("button", {
name: "开发工具,分类页将在下一阶段提供",
}),
).toHaveAttribute("aria-disabled", "true")
expect(
screen.queryByRole("link", { name: /开发工具/ }),
).not.toBeInTheDocument()
expect(screen.getByRole("link", { name: "首页" })).toHaveAttribute(
"aria-current",
"page",
)
expect(screen.getByRole("link", { name: "开发工具" })).toHaveAttribute(
"href",
"/categories/dev",
)
})
it("分类页只选中当前分类", () => {
render(
<AppShell
categories={categories}
siteName="Polaris"
defaultCollapsed={false}
activeCategoryId="dev"
>
<main>分类内容</main>
</AppShell>,
)
expect(screen.getByRole("link", { name: "首页" })).not.toHaveAttribute(
"aria-current",
)
expect(screen.getByRole("link", { name: "开发工具" })).toHaveAttribute(
"aria-current",
"page",
)
})
it("折叠状态仍保留分类链接的可访问名称", () => {
render(
<AppShell
categories={categories}
siteName="Polaris"
defaultCollapsed={true}
activeCategoryId="dev"
>
<main>分类内容</main>
</AppShell>,
)
expect(screen.getByRole("link", { name: "开发工具" })).toHaveAttribute(
"aria-current",
"page",
)
})
})