Roots + lazy dir tree, virtualized grid with status badges and asset/slot/ download links, breadcrumb, sort, glob search, hidden toggle, filter chips, paging and truncation notice; multi-select (Shift/Ctrl/all), action bar, context menu, drag-to-move with dryRun preview, keyboard navigation, offline (503) and empty/error states, mobile layout with tree drawer. Rename/move/copy/delete dialogs with dryRun previews and reference checks, 4-step organize wizard, trash view (restore/restore-to/purge, expiry). DEV-only ?mock=1 in-memory backend; smoke route list includes /console/files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
24 lines
975 B
TypeScript
24 lines
975 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { consolePath, findNavItem, NAV_ITEMS } from "./nav.ts";
|
|
|
|
describe("控制台导航", () => {
|
|
it("12 个工作区 + 引擎面板 + 审计,路径唯一且都在 /console 下", () => {
|
|
expect(NAV_ITEMS).toHaveLength(15);
|
|
expect(new Set(NAV_ITEMS.map((i) => i.to)).size).toBe(15);
|
|
expect(NAV_ITEMS.every((i) => i.to.startsWith("/console"))).toBe(true);
|
|
});
|
|
|
|
it("按最长前缀匹配当前项", () => {
|
|
expect(findNavItem("/console")?.label).toBe("首页");
|
|
expect(findNavItem("/console/")?.label).toBe("首页");
|
|
expect(findNavItem("/console/library/abc")?.label).toBe("媒体库");
|
|
expect(findNavItem("/console/engine/r1")?.label).toBe("工作流引擎");
|
|
expect(findNavItem("/nope")).toBeUndefined();
|
|
});
|
|
|
|
it("consolePath 拼路径并编码", () => {
|
|
expect(consolePath()).toBe("/console");
|
|
expect(consolePath("library", "a b")).toBe("/console/library/a%20b");
|
|
});
|
|
});
|