Files
mnote/wolai-frontend/src/components/sidebar/sidebar-dnd-source.test.ts
T
lix-2026 f9336257a5 chore(tree): remove legacy iframe tree shell
Remove the active TreeShellIframeHost path and legacy env flag so rust_family only mounts the Rust/WASM DOM shell host.

Move legacy iframe host files to ignored recycle storage, clear tracked recycle cache entries, and update tree-domain design wording to the current no-iframe position.

Align filetree default active rows with doc:<documentId> and update the renderer artifact bridge contract to dom_wasm.
2026-05-16 08:57:40 +08:00

28 lines
1.5 KiB
TypeScript

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 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 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(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))");
});
});