@intentius/behold 0.29.47 → 0.29.49
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/dist/cli.js +14 -11
- package/package.json +1 -1
- package/web/app.js +22 -0
- package/web/event-help-modal.js +13 -3
- package/web/kiosk-annotations.js +2 -2
- package/web/kiosk-event-help-ui.js +46 -9
- package/web/kiosk-event-help.js +6 -3
- package/web/kiosk-metrics.js +39 -8
- package/web/kiosk-metrics.test.js +36 -1
- package/web/kiosk-modal-sticky.test.js +27 -3
- package/web/kiosk-popover.js +29 -1
- package/web/kiosk-popover.test.js +32 -0
- package/web/kiosk-replay.test.js +79 -0
- package/web/kiosk-result.test.js +36 -0
- package/web/kiosk-runs.js +12 -0
- package/web/kiosk-story-gate.test.js +22 -1
- package/web/kiosk-trace.js +84 -21
- package/web/kiosk-trace.test.js +56 -10
- package/web/kiosk-track.js +138 -12
- package/web/kiosk-track.test.js +84 -1
- package/web/kiosk-watch.js +3 -1
- package/web/kiosk-watch.test.js +2 -0
- package/web/kiosk-wave-list.js +130 -0
- package/web/kiosk-wave-list.test.js +103 -0
- package/web/kiosk.html +85 -10
- package/web/kiosk.js +328 -54
- package/web/kiosk.test.js +112 -2
- package/web/small-stage.test.js +8 -0
package/web/kiosk.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { stepTone, nextProgress, nextSeen,
|
|
2
|
+
import { FOLLOW_WORDS, RESUME_WORDS, TAP_HOLD_MS, heldWords, touchScreen, stepTone, nextProgress, nextSeen,BEAT_CHANGES, INTRO_HEAD, READ_STORE, READ_TITLE, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, factsLine, focusRoots, holdHead, holdModel, introText, readStored, readingRows, renderReading, scenarioHead, frameSrc, factLines, kioskView, matchingPull, pendingApproval, renderKiosk, renderViewToggle, reportless, runPanel, runPin, stepView, viewZoom } from "./kiosk.js";
|
|
3
3
|
import { VENDORS } from "./kiosk-vendor.js";
|
|
4
4
|
import { PICK_HOLD_MS } from "./kiosk-runs.js";
|
|
5
5
|
|
|
@@ -142,6 +142,30 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
142
142
|
};
|
|
143
143
|
const find = (n, cls) => (n.className.split(" ").includes(cls) ? [n] : []).concat(...(n.children || []).map((c) => (c.className !== undefined ? find(c, cls) : [])));
|
|
144
144
|
|
|
145
|
+
// behold#801: Inspect's header shows each finished wave's trace in its right box, as Watch's result card does.
|
|
146
|
+
it("lists each finished wave's trace in the right box, and nothing there before one lands", () => {
|
|
147
|
+
const was = globalThis.document;
|
|
148
|
+
// The trace rows set their bars' style and listen for a click.
|
|
149
|
+
const base = fakeDocument();
|
|
150
|
+
globalThis.document = { createElement: (tag) => Object.assign(base.createElement(tag), { style: {}, addEventListener() {} }) };
|
|
151
|
+
try {
|
|
152
|
+
const T = 1_792_166_000_000;
|
|
153
|
+
const spans = [{ id: "s", parent: null, name: "tf-apply", start: T, ms: 4000, attrs: {} }, { id: "a", parent: "s", name: "apply", start: T, ms: 4000, attrs: { "terragucci.phase": "apply" } }];
|
|
154
|
+
const s = { demo: { source: "fx", read: "2026-10-15T03:00:00Z", demo: demo("applying", { scenario: "failure", about }) }, answer: null, progress: null, waveTraces: {} };
|
|
155
|
+
let bar = document.createElement("header");
|
|
156
|
+
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
157
|
+
expect(find(bar, "k-i-traces")).toEqual([]);
|
|
158
|
+
s.waveTraces = { 1: { run: "8047", job: "apply-wave-1", trace: { start: T, ms: 4000, spans } } };
|
|
159
|
+
bar = document.createElement("header");
|
|
160
|
+
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
161
|
+
const box = find(find(bar, "k-right")[0], "k-i-traces");
|
|
162
|
+
expect(box.length).toBe(1);
|
|
163
|
+
expect(find(box[0], "k-wf-row").map((r) => r.children[0].textContent)).toEqual(["Wave 1"]);
|
|
164
|
+
} finally {
|
|
165
|
+
globalThis.document = was;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
145
169
|
it("draws the card right under the title, and none without about", () => {
|
|
146
170
|
const was = globalThis.document;
|
|
147
171
|
globalThis.document = fakeDocument();
|
|
@@ -155,7 +179,8 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
155
179
|
expect(left.children.map((c) => c.className)).toEqual([
|
|
156
180
|
"k-box k-box-title", "k-row k-row-beat", "k-row k-row-step k-step-failed", "k-row k-row-next", "k-row k-row-more", "k-row k-row-more", "k-row k-row-facts k-row-empty",
|
|
157
181
|
]);
|
|
158
|
-
|
|
182
|
+
// behold#777: under the title, the phone's line on what this is (CSS shows it on a phone only).
|
|
183
|
+
expect(left.children.map((c) => c.children.map((x) => x.className.split(" ")[0]))).toEqual([["k-overline", "k-title", "k-w-intro"],["k-row-label", "k-box"], ["k-row-label", "k-box"], ["k-row-label", "k-box", "k-nbar"], ["k-row-label", "k-box"], ["k-row-label", "k-box"], []]);
|
|
159
184
|
// The next row's bar is placed by CSS, in the step's tone; a stalled driver's next has none.
|
|
160
185
|
const nbar = find(bar, "k-nbar")[0];
|
|
161
186
|
expect(nbar.className).toBe("k-nbar k-nbar-none");
|
|
@@ -383,6 +408,9 @@ describe("which view the frame shows (#571)", () => {
|
|
|
383
408
|
|
|
384
409
|
renderViewToggle(host, { view: "resources", pinned: true, secs: 42 }, { components: true });
|
|
385
410
|
expect(host.children[1].textContent).toBe("each resource the change touches · held by a click; the step leads again in 42 s");
|
|
411
|
+
// behold#779: on a touch screen it was a tap.
|
|
412
|
+
renderViewToggle(host, { view: "resources", pinned: true, secs: 42 }, { components: true, touch: true });
|
|
413
|
+
expect(host.children[1].textContent).toBe("each resource the change touches · held by a tap; the step leads again in 42 s");
|
|
386
414
|
|
|
387
415
|
renderViewToggle(host, { view: "resources", pinned: false, secs: null }, { components: false });
|
|
388
416
|
expect(host.hidden).toBe(true);
|
|
@@ -559,3 +587,85 @@ describe("nextProgress and nextSeen", () => {
|
|
|
559
587
|
expect(nextSeen(nextSeen(undefined, null, "live", 0), a, "live", 6000).seen).toBe(6000);
|
|
560
588
|
});
|
|
561
589
|
});
|
|
590
|
+
|
|
591
|
+
describe("kiosk: a phone's trace rows under the step (behold#775)", () => {
|
|
592
|
+
const fakeDocument = () => {
|
|
593
|
+
const make = (tag) => {
|
|
594
|
+
const n = { tagName: tag, className: "", textContent: "", children: [], dataset: {}, style: {}, hidden: false, on: {} };
|
|
595
|
+
n.appendChild = (c) => (n.children.push(c), c);
|
|
596
|
+
n.append = (...cs) => cs.forEach((c) => n.children.push(typeof c === "string" ? { tagName: "#text", textContent: c, children: [] } : c));
|
|
597
|
+
n.replaceChildren = () => (n.children = []);
|
|
598
|
+
n.addEventListener = (k, f) => (n.on[k] = f);
|
|
599
|
+
return n;
|
|
600
|
+
};
|
|
601
|
+
return { createElement: make };
|
|
602
|
+
};
|
|
603
|
+
const find = (n, cls) => (n.className.split(" ").includes(cls) ? [n] : []).concat(...(n.children || []).map((c) => (c.className !== undefined ? find(c, cls) : [])));
|
|
604
|
+
const T = 1_792_166_000_000;
|
|
605
|
+
const trace = (wave, ms) => ({
|
|
606
|
+
start: T + wave * 10_000,
|
|
607
|
+
ms,
|
|
608
|
+
spans: [
|
|
609
|
+
{ id: "s", parent: null, name: "tf-apply", start: T, ms, attrs: {} },
|
|
610
|
+
{ id: "p", parent: "s", name: "plan", start: T, ms: ms / 2, attrs: { "terragucci.phase": "plan" } },
|
|
611
|
+
{ id: "a", parent: "s", name: "apply", start: T + ms / 2, ms: ms / 2, attrs: { "terragucci.phase": "apply" } },
|
|
612
|
+
],
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it("draws a row per wave with a trace as each lands, opens that wave's trace on a tap, and none once the result card has them", async () => {
|
|
616
|
+
const { drawWaveTraces, WAVE_TRACES_WORDS, TRACE_LINK_WORDS } = await import("./kiosk.js");
|
|
617
|
+
const was = globalThis.document;
|
|
618
|
+
globalThis.document = fakeDocument();
|
|
619
|
+
try {
|
|
620
|
+
const host = document.createElement("section");
|
|
621
|
+
const opened = [];
|
|
622
|
+
const s = { waveTraces: {}, openWave: (n, view) => opened.push([n, view]) };
|
|
623
|
+
drawWaveTraces(host, s);
|
|
624
|
+
expect(host.hidden).toBe(true);
|
|
625
|
+
expect(host.children).toEqual([]);
|
|
626
|
+
// Wave 1 finished: its row shows at once, before the run is done.
|
|
627
|
+
s.waveTraces = { 1: { run: "8047", job: "apply-wave-1", trace: trace(1, 2000) } };
|
|
628
|
+
drawWaveTraces(host, s);
|
|
629
|
+
expect(host.hidden).toBe(false);
|
|
630
|
+
expect(host.children[0].textContent).toBe(WAVE_TRACES_WORDS);
|
|
631
|
+
let rows = find(host, "k-wf-row");
|
|
632
|
+
expect(rows.map((r) => r.children[0].textContent)).toEqual(["Wave 1"]);
|
|
633
|
+
expect(rows[0].children[3].textContent).toBe(TRACE_LINK_WORDS);
|
|
634
|
+
s.waveTraces[2] = { run: "8047", job: "apply-wave-2", trace: trace(2, 4000) };
|
|
635
|
+
drawWaveTraces(host, s);
|
|
636
|
+
rows = find(host, "k-wf-row");
|
|
637
|
+
expect(rows.map((r) => r.children[0].textContent)).toEqual(["Wave 1", "Wave 2"]);
|
|
638
|
+
rows[1].on.click();
|
|
639
|
+
expect(opened).toEqual([[2, "trace"]]);
|
|
640
|
+
// At the end the result card lists the same rows, so these go.
|
|
641
|
+
drawWaveTraces(host, s, { shown: false });
|
|
642
|
+
expect(host.hidden).toBe(true);
|
|
643
|
+
expect(host.children).toEqual([]);
|
|
644
|
+
} finally {
|
|
645
|
+
globalThis.document = was;
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// behold#779: on a phone a stray tap on the graph held Watch's shot 90 s, under words about a click.
|
|
651
|
+
describe("a held shot on a touch screen", () => {
|
|
652
|
+
it("says it was a tap, holds a shorter time, and its button says resume", () => {
|
|
653
|
+
expect(heldWords(42)).toBe("Held where you left it · the steps lead again in 42 s");
|
|
654
|
+
expect(heldWords(12, true)).toBe("Paused where you tapped · the steps go on in 12 s");
|
|
655
|
+
expect(TAP_HOLD_MS).toBeLessThan(PICK_HOLD_MS);
|
|
656
|
+
expect([FOLLOW_WORDS, RESUME_WORDS]).toEqual(["Follow the steps", "Resume now"]);
|
|
657
|
+
});
|
|
658
|
+
it("reads a touch screen from a coarse pointer", () => {
|
|
659
|
+
const was = globalThis.matchMedia;
|
|
660
|
+
try {
|
|
661
|
+
globalThis.matchMedia = (q) => ({ matches: q === "(pointer: coarse)" });
|
|
662
|
+
expect(touchScreen()).toBe(true);
|
|
663
|
+
globalThis.matchMedia = () => ({ matches: false });
|
|
664
|
+
expect(touchScreen()).toBe(false);
|
|
665
|
+
delete globalThis.matchMedia;
|
|
666
|
+
expect(touchScreen()).toBe(false);
|
|
667
|
+
} finally {
|
|
668
|
+
globalThis.matchMedia = was;
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
});
|
package/web/small-stage.test.js
CHANGED
|
@@ -106,6 +106,14 @@ describe("nothing overlays the graph in Watch, on a held small stage only", () =
|
|
|
106
106
|
expect(tipsShown({ watch: false, held: true })).toBe(true);
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
+
it("applied: Watch's result card says it, so no modal says it again; Inspect, with no card, opens it (behold#782)", () => {
|
|
110
|
+
expect(modalShownElsewhere({ kind: "applied" }, { watch: true, result: true })).toBe(true);
|
|
111
|
+
// Before the card has the run to draw, the modal opens as before.
|
|
112
|
+
expect(modalShownElsewhere({ kind: "applied" }, { watch: true, result: false })).toBe(false);
|
|
113
|
+
expect(modalShownElsewhere({ kind: "applied" }, { watch: false, result: true })).toBe(false);
|
|
114
|
+
for (const kind of ["held", "failed", "refused"]) expect(modalShownElsewhere({ kind }, { watch: true, result: true })).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
109
117
|
it("held: says what the cards said in one quiet line of the caption; not held, no such line", () => {
|
|
110
118
|
const result = { head: "Applied", line: "Done in 2 waves.", counts: ["2 waves applied", "1 updated", "3.2 s of job time"], waves: [] };
|
|
111
119
|
expect(stepLine(demo("applied"), { result, held: true })).toBe("2 waves applied · 1 updated · 3.2 s of job time");
|