ai-chatbot/tests/routes/canvas-shortcut-help.test.ts

73 lines
2.2 KiB
TypeScript

import { expect, test } from "@playwright/test";
import { VIDEO_CANVAS_SHORTCUT_HELP_GROUPS } from "@/lib/canvas/shortcut-help";
test.describe("video canvas shortcut help", () => {
test("matches the observed group and row order", () => {
expect(
VIDEO_CANVAS_SHORTCUT_HELP_GROUPS.map((group) => ({
rows: group.rows.map((row) => row.label),
title: group.title,
})),
).toEqual([
{
rows: [
"成组",
"合并分镜组",
"解组",
"连线",
"复制节点和连线",
"生成",
"新建节点",
"节点复制",
"创建副本",
],
title: "创作",
},
{
rows: ["放大", "缩小", "适应画布", "触控板", "鼠标"],
title: "缩放",
},
{
rows: ["键盘", "触控板", "鼠标", "整理画布"],
title: "移动画布",
},
{ rows: ["撤销", "重做", "删除"], title: "其他" },
]);
});
test("keeps command modifiers and drag suffixes as separate keycaps", () => {
const creationRows = VIDEO_CANVAS_SHORTCUT_HELP_GROUPS[0].rows;
expect(creationRows[0].tokens).toEqual(["command", "G"]);
expect(creationRows[4].tokens).toEqual(["command", "D"]);
expect(creationRows[7]).toMatchObject({
suffix: "+拖动节点",
tokens: ["Option"],
});
expect(creationRows[8]).toMatchObject({
suffix: "+拖动",
tokens: ["command", "Option"],
});
});
test("represents zoom, pan, undo, redo and delete controls", () => {
expect(VIDEO_CANVAS_SHORTCUT_HELP_GROUPS[1].rows).toMatchObject([
{ tokens: ["command", "plus"] },
{ tokens: ["command", "minus"] },
{ tokens: ["command", "0"] },
{ tokens: ["trackpad-zoom"] },
{ tokens: ["command", "mouse"] },
]);
expect(VIDEO_CANVAS_SHORTCUT_HELP_GROUPS[2].rows).toMatchObject([
{ tokens: ["Space", "mouse"] },
{ tokens: ["trackpad-pan"] },
{ tokens: ["mouse-pan"] },
{ tokens: ["⌥", "⇧", "F"] },
]);
expect(VIDEO_CANVAS_SHORTCUT_HELP_GROUPS[3].rows).toMatchObject([
{ tokens: ["command", "Z"] },
{ tokens: ["command", "⇧", "Z"] },
{ tokens: ["delete"] },
]);
});
});