Both cards on the jobs tab start shut and read nothing until opened; a link with ?run= opens the builds card. The fold-and-build-on-first-open part of the hives card is now one LazyDisclosure, which the hives card uses too. Docs follow.
16 lines
537 B
JavaScript
16 lines
537 B
JavaScript
// A folded card fetches nothing until first opened. Run by `npm test`.
|
|
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import { builtAfterToggle } from "../src/ui/disclosure/lazy-open.ts";
|
|
|
|
test("a card nobody opened is not built", () => {
|
|
assert.equal(builtAfterToggle(false, false), false);
|
|
});
|
|
|
|
test("the first open builds it", () => {
|
|
assert.equal(builtAfterToggle(false, true), true);
|
|
});
|
|
|
|
test("closing it afterwards keeps it built", () => {
|
|
assert.equal(builtAfterToggle(true, false), true);
|
|
});
|