@firstpick/pi-package-webui 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/bin/pi-webui.mjs +266 -67
- package/lib/git-live-watcher.mjs +135 -0
- package/lib/git-message-artifacts.mjs +103 -0
- package/lib/process-tree.mjs +3 -1
- package/package.json +4 -3
- package/public/app.js +482 -73
- package/public/index.html +3 -2
- package/public/styles.css +92 -5
- package/tests/app-runner-windows-conpty-harness.test.mjs +140 -0
- package/tests/danger-button-contrast-static.test.mjs +32 -0
- package/tests/fixtures/fake-pi.mjs +1 -0
- package/tests/footer-middle-truncation.test.mjs +118 -0
- package/tests/git-live-watcher.test.mjs +93 -0
- package/tests/git-message-artifacts.test.mjs +59 -0
- package/tests/git-panel-live-updates-static.test.mjs +54 -0
- package/tests/git-panel-render-stability-static.test.mjs +1 -1
- package/tests/guided-git-message-reliability-static.test.mjs +38 -0
- package/tests/http-endpoints-harness.test.mjs +52 -5
- package/tests/image-payload-hardening-harness.test.mjs +115 -0
- package/tests/mobile-static.test.mjs +24 -9
- package/tests/pi-footer-calibration-static.test.mjs +55 -0
- package/tests/runtime-error-visibility.test.mjs +63 -0
- package/tests/side-panel-context-menu-static.test.mjs +74 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const [html, app, css] = await Promise.all([
|
|
8
|
+
readFile(join(root, "public", "index.html"), "utf8"),
|
|
9
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
10
|
+
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
assert.match(
|
|
14
|
+
html,
|
|
15
|
+
/id="sidePanelContextMenu"[^>]*role="menu"[^>]*aria-label="Choose visible side panel sections"[^>]*hidden/,
|
|
16
|
+
"the page should provide an initially hidden, labelled side-panel context menu",
|
|
17
|
+
);
|
|
18
|
+
assert.match(
|
|
19
|
+
app,
|
|
20
|
+
/const SIDE_PANEL_SECTION_VISIBILITY_STORAGE_KEY = "pi-webui-side-panel-sections-hidden"/,
|
|
21
|
+
"hidden section IDs should use their own browser storage key",
|
|
22
|
+
);
|
|
23
|
+
assert.match(
|
|
24
|
+
app,
|
|
25
|
+
/function persistSidePanelSectionVisibility\(\)[\s\S]*section\.hidden[\s\S]*localStorage\.setItem\(SIDE_PANEL_SECTION_VISIBILITY_STORAGE_KEY, JSON\.stringify\(hidden\)\)/,
|
|
26
|
+
"section visibility should persist independently from accordion collapse state",
|
|
27
|
+
);
|
|
28
|
+
assert.match(
|
|
29
|
+
app,
|
|
30
|
+
/function restoreSidePanelSectionVisibility\(\)[\s\S]*readStoredSidePanelSectionHiddenIds\(\)[\s\S]*setSidePanelSectionVisible\(record, !hiddenIds\.has\(record\.id\), \{ persist: false \}\)/,
|
|
31
|
+
"stored hidden section IDs should be restored without rewriting storage",
|
|
32
|
+
);
|
|
33
|
+
assert.match(
|
|
34
|
+
app,
|
|
35
|
+
/function showSidePanelContextMenu\(event\)[\s\S]*sidePanelSectionRecords\(\)\.map[\s\S]*role", "menuitemcheckbox"[\s\S]*aria-checked[\s\S]*setSidePanelSectionVisible\(record, nextVisible\)/,
|
|
36
|
+
"the context menu should dynamically include every section as a checkable visibility item",
|
|
37
|
+
);
|
|
38
|
+
assert.match(
|
|
39
|
+
app,
|
|
40
|
+
/function setSidePanelSectionVisible\(record, visible[\s\S]*visible && record\.id === "git"[\s\S]*renderGitPanel\(\)[\s\S]*ensureGitPanelRepositoriesDiscovered/,
|
|
41
|
+
"re-showing an expanded Git section should immediately refresh its deferred content",
|
|
42
|
+
);
|
|
43
|
+
assert.match(
|
|
44
|
+
app,
|
|
45
|
+
/const focusTarget = trigger\?\.isConnected[\s\S]*elements\.toggleSidePanelButton[\s\S]*focusTarget\.focus/,
|
|
46
|
+
"closing the menu should return focus to its trigger or the persistent panel toggle",
|
|
47
|
+
);
|
|
48
|
+
assert.match(
|
|
49
|
+
app,
|
|
50
|
+
/side-panel-context-menu-label", "Show sections"[\s\S]*role", "presentation"[\s\S]*aria-hidden", "true"/,
|
|
51
|
+
"the visual menu heading should not violate the menu's accessibility structure",
|
|
52
|
+
);
|
|
53
|
+
assert.match(
|
|
54
|
+
app,
|
|
55
|
+
/function bindSidePanelContextMenu\(\)[\s\S]*addEventListener\("contextmenu", showSidePanelContextMenu\)[\s\S]*event\.key !== "ContextMenu"[\s\S]*event\.shiftKey && event\.key === "F10"/,
|
|
56
|
+
"the menu should support pointer and standard keyboard context-menu activation",
|
|
57
|
+
);
|
|
58
|
+
assert.match(
|
|
59
|
+
app,
|
|
60
|
+
/restoreSidePanelSectionVisibility\(\);\s*restoreSidePanelSectionState\(\);/,
|
|
61
|
+
"visibility should restore alongside the existing collapse state during startup",
|
|
62
|
+
);
|
|
63
|
+
assert.match(
|
|
64
|
+
app,
|
|
65
|
+
/event\.key === "ArrowDown" \|\| event\.key === "ArrowUp"[\s\S]*elements\.sidePanelContextMenu\?\.addEventListener\("keydown"[\s\S]*event\.key === "Home" \|\| event\.key === "End"/,
|
|
66
|
+
"context-menu items should be keyboard navigable",
|
|
67
|
+
);
|
|
68
|
+
assert.match(
|
|
69
|
+
css,
|
|
70
|
+
/\.side-panel-context-menu[\s\S]*max-height:[^;]+[\s\S]*overflow-y: auto[\s\S]*\.side-panel-context-menu-item\[aria-checked="true"\]::before/,
|
|
71
|
+
"the section menu should remain viewport-bounded and visibly mark selected sections",
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
console.log("side-panel-context-menu-static.test.mjs passed");
|