Files
pi-agent-integrated/pi-web/components/SessionSidebar.test.mjs
T

20 lines
809 B
JavaScript

import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
const source = await readFile(new URL("./SessionSidebar.tsx", import.meta.url), "utf8");
const sessionItemSource = source.slice(source.indexOf("function SessionItem("));
test("only Shift+click bypasses session deletion confirmation", () => {
assert.match(
sessionItemSource,
/const handleDeleteClick[\s\S]*?if \(e\.shiftKey\) \{\s*void performDelete\(\);\s*\} else \{\s*setConfirmDelete\(true\);/,
);
});
test("does not register row-level session deletion shortcuts", () => {
assert.doesNotMatch(sessionItemSource, /const handleKeyDown/);
assert.doesNotMatch(sessionItemSource, /onKeyDown=\{handleKeyDown\}/);
assert.doesNotMatch(sessionItemSource, /tabIndex=\{0\}/);
});