feat(tree): checkpoint resource lifecycle work
提交当前顶层 mnote Git 工作区,范围集中在 04-tree-domain 的 resource/trash/filetree 生命周期、mnote-web resource_trash 路由、Convex/Next 兼容接口、sidebar/file-tree 客户端适配、smoke 脚本与对应设计/bug 记录。 不包含被 ignore 的 design/05-editor-mainline/reference-code/leptos-tiptap 嵌套仓库改动。新增 smoke 的测试密码改为运行时读取 MNOTE_E2E_PASSWORD,避免提交明文 credential assignment。
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const DOM_HOST_SOURCE = path.join(process.cwd(), "src/components/sidebar/tree-shell-dom-host.tsx");
|
||||
const IFRAME_HOST_SOURCE = path.join(process.cwd(), "src/components/sidebar/tree-shell-iframe-host.tsx");
|
||||
const SIDEBAR_SOURCE = path.join(process.cwd(), "src/components/sidebar/sidebar.tsx");
|
||||
const SSR_LAYOUT_SOURCE = path.join(process.cwd(), "..", "rust/crates/mnote-web/src/ssr/pages/layout.rs");
|
||||
|
||||
describe("sidebar filetree DnD modifier source", () => {
|
||||
it("copy modifier 应同时支持 Alt / Ctrl / Meta", () => {
|
||||
const domHost = fs.readFileSync(DOM_HOST_SOURCE, "utf8");
|
||||
const iframeHost = fs.readFileSync(IFRAME_HOST_SOURCE, "utf8");
|
||||
const ssrLayout = fs.readFileSync(SSR_LAYOUT_SOURCE, "utf8");
|
||||
|
||||
expect(domHost).toContain('event.altKey || event.ctrlKey || event.metaKey ? "copy" : "move"');
|
||||
expect(domHost).toContain("const copy = Boolean(event.altKey || event.ctrlKey || event.metaKey)");
|
||||
expect(iframeHost).toContain("copy: event?.altKey === true || event?.ctrlKey === true || event?.metaKey === true");
|
||||
expect(ssrLayout).toContain("var copyModifier = event.altKey || event.ctrlKey || event.metaKey");
|
||||
expect(ssrLayout).toContain("copy: event.altKey === true || event.ctrlKey === true || event.metaKey === true");
|
||||
});
|
||||
|
||||
it("命名冲突 preflight 必须确认后才执行 drop", () => {
|
||||
const source = fs.readFileSync(SIDEBAR_SOURCE, "utf8");
|
||||
expect(source).toContain("function confirmFileTreeDropConflicts");
|
||||
expect(source).toContain("plan.requiresConfirmation");
|
||||
expect(source).toContain("目标位置已有同名对象,是否继续移动/复制?");
|
||||
expect(source).toContain("if (!confirmFileTreeDropConflicts(dropPlan))");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user