Files
pipelines/web/test/layoutPrefs.test.mjs
T
alan 3314f8405b web: one status glyph, a compact settings button and collapsible panes
- Run and pipeline rows use one coloured status glyph with the word in its
  tooltip; the run version sits at the right of the title line; the usage
  metrics row is gone.
- Settings is an icon beside the connection status (rail and dock), not a
  destination tab; the destinations keep a roving tab even while Settings is
  open.
- The rail and every list pane collapse to a narrow strip from an icon at their
  top-right (remembered per device). A collapsed runs list shows the status
  glyph, pipelines their flow glyph, chats their status word.
- Tool calls open in a modal (rendered/expanded rows in place) instead of an
  inline popover; the chip stays a quiet line beside the message.
- Refresh tooltips show the last data arrival (manual or socket) per
  destination.
2026-10-20 01:36:38 +01:00

34 lines
1.4 KiB
JavaScript

// The rail/list collapse choices are a local layout preference.
import { test } from "node:test";
import assert from "node:assert/strict";
import { LAYOUT_KEY, readLayoutPrefs, writeLayoutPrefs } from "../src/layoutPrefs.js";
function fakeStorage(initial = {}) {
const values = new Map(Object.entries(initial));
return {
getItem: (key) => (values.has(key) ? values.get(key) : null),
setItem: (key, value) => values.set(key, String(value)),
values,
};
}
test("both panes are expanded when nothing was stored", () => {
assert.deepEqual(readLayoutPrefs(fakeStorage()), { railCollapsed: false, listCollapsed: false });
});
test("the two choices survive a write and read independently", () => {
const storage = fakeStorage();
writeLayoutPrefs({ railCollapsed: true, listCollapsed: false }, storage);
assert.deepEqual(readLayoutPrefs(storage), { railCollapsed: true, listCollapsed: false });
assert.ok(storage.values.get(LAYOUT_KEY).includes("railCollapsed"));
});
test("malformed storage and failures fall back to expanded", () => {
assert.deepEqual(readLayoutPrefs(fakeStorage({ [LAYOUT_KEY]: "{oops" })), {
railCollapsed: false,
listCollapsed: false,
});
const broken = { getItem() { throw new Error("denied"); }, setItem() { throw new Error("denied"); } };
assert.doesNotThrow(() => writeLayoutPrefs({ railCollapsed: true }, broken));
});