新 lib/nav/ai-tools.ts (aiToolItems) + components/AiToolbar.tsx 服务端组件;AppShell 顶栏下渲染(仅项目页),用 --chrome CSS 变量统一 chrome 高度,6 个固定高度页改用 calc(100vh-var(--chrome,4rem)) 适配。TDD: ai-tools 测。前端门禁绿: lint/tsc/vitest/build。
29 lines
848 B
TypeScript
29 lines
848 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { aiToolItems } from "./ai-tools";
|
|
|
|
describe("aiToolItems", () => {
|
|
it("returns 5 items", () => {
|
|
expect(aiToolItems("p1")).toHaveLength(5);
|
|
});
|
|
|
|
it("leads with 写本章 (primary, key write)", () => {
|
|
const [first] = aiToolItems("p1");
|
|
expect(first.label).toBe("写本章");
|
|
expect(first.primary).toBe(true);
|
|
expect(first.key).toBe("write");
|
|
});
|
|
|
|
it("scopes every href under the project path", () => {
|
|
for (const item of aiToolItems("abc")) {
|
|
expect(item.href.startsWith("/projects/abc/")).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("maps 审稿 to the review page and key", () => {
|
|
const review = aiToolItems("p1").find((item) => item.label === "审稿");
|
|
expect(review?.href).toBe("/projects/p1/review");
|
|
expect(review?.key).toBe("review");
|
|
});
|
|
});
|