feat: clickable star in the history panel, + form for the dock
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
f880f7ef06
commit
7e23b8a79c
5 files changed
+212
-10
No files matched your search
+13
-1
@@ -2,7 +2,7 @@ import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
DOCK_LIMIT, LABEL_MAX, defaultLabel, normalize, isPinned, pin, unpin, remove, move,
|
||||
rename, toggleMode, dockAction, dockMenu, rowMenu, starMenu, menuTransition, applyDock,
|
||||
rename, toggleMode, dockAction, dockMenu, rowMenu, starMenu, menuTransition, applyDock, add,
|
||||
} from "../herdr/herdr-composer/mods/herdr-composer/dock.js";
|
||||
|
||||
const btn = (id, text, extra = {}) => ({ id, label: text, text, mode: "send", ...extra });
|
||||
@@ -158,3 +158,15 @@ test("applyDock: works on the stored list, so another copy's change survives", (
|
||||
assert.deepEqual(applyDock("rubbish", (d) => pin(d, "x", "9")).map((b) => b.id), ["9"]);
|
||||
assert.deepEqual(applyDock(stored, (d) => remove(d, "1")).map((b) => b.id), ["2"]);
|
||||
});
|
||||
|
||||
test("add: label, mode, empty text, duplicate, limit", () => {
|
||||
const a = add([], { id: "1", text: " /handoff ", label: "", mode: "send" });
|
||||
assert.deepEqual(a, [{ id: "1", label: "/handoff", text: "/handoff", mode: "send" }]);
|
||||
const b = add(a, { id: "2", text: "npm test", label: " Testy ", mode: "insert" });
|
||||
assert.deepEqual(b[1], { id: "2", label: "Testy", text: "npm test", mode: "insert" });
|
||||
assert.equal(add(b, { id: "3", text: " ", label: "x", mode: "send" }), b);
|
||||
assert.equal(add(b, { id: "3", text: "npm test", label: "x", mode: "send" }), b);
|
||||
const full = Array.from({ length: DOCK_LIMIT }, (_, i) => btn(`f${i}`, `t${i}`));
|
||||
assert.equal(add(full, { id: "n", text: "new", label: "", mode: "send" }), full);
|
||||
assert.equal(add([], { id: "1", text: "x", label: "", mode: "bogus" })[0].mode, "send");
|
||||
});
|
||||
Reference in new issue
Block a user