Merge remote-tracking branch 'origin/main' into oboe
# Conflicts: # web/src/catalog.ts
This commit is contained in:
@@ -120,6 +120,43 @@ describe("sidebar keyboard navigation", () => {
|
||||
expect(asked).toBe(1);
|
||||
});
|
||||
|
||||
it("c collapses and expands the highlighted folder", () => {
|
||||
const { el } = twoFolders();
|
||||
const header = el.querySelectorAll<HTMLElement>(".tree-folder-header")[0];
|
||||
header.click(); // collapse /one, so the walk stops on its header
|
||||
|
||||
press(tree(el), "j");
|
||||
expect(highlighted(el)).toBe("folder:one");
|
||||
press(tree(el), "c");
|
||||
// Expanded: the card it was hiding is back in the walk.
|
||||
expect(el.querySelector(`[data-nav-key="session:${A}"]`)).not.toBeNull();
|
||||
});
|
||||
|
||||
it("r renames the highlighted session in place", () => {
|
||||
const { el } = twoFolders();
|
||||
press(tree(el), "j");
|
||||
press(tree(el), "r");
|
||||
const field = el.querySelector<HTMLInputElement>(".leaf-rename");
|
||||
expect(field).not.toBeNull();
|
||||
// Escape settles the rename, so the module-level "a row is being renamed"
|
||||
// flag doesn't leak into the next test.
|
||||
field!.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));
|
||||
});
|
||||
|
||||
it("x kills the highlighted session", async () => {
|
||||
const { el } = twoFolders();
|
||||
const killed: string[] = [];
|
||||
window.fetch = ((input: RequestInfo | URL, init?: RequestInit) => {
|
||||
killed.push(`${init?.method ?? "GET"} ${String(input)}`);
|
||||
return Promise.resolve(new Response(null, { status: 204 }));
|
||||
}) as typeof window.fetch;
|
||||
|
||||
press(tree(el), "j");
|
||||
press(tree(el), "x");
|
||||
await Promise.resolve();
|
||||
expect(killed.some((r) => r.startsWith("DELETE") && r.includes(A))).toBe(true);
|
||||
});
|
||||
|
||||
it("leaves the keyboard alone while a row is being renamed", () => {
|
||||
const { el } = twoFolders();
|
||||
press(tree(el), "j");
|
||||
|
||||
Reference in New Issue
Block a user