Files
kiri/tests/ui/window-script-types.js
e2ace95369 UI, Linux & docs: volume/network usage, log sort toggle, fontconfig stall recovery, and docs fixes (#1099)
- Volumes & Networks `Used by` column (`#1062`): show container consumer counts, per-state badges, and escaped container-name tooltips on Volumes and Networks across macOS, Windows, and Linux, with `Used by` column sorting on Volumes.
- Window script type-check fixes (`#1033`): pass `String(!on)` to `aria-pressed` in `setRail`, check `Number.isNaN(d.getTime())` in `dgTime`, and sequence `closeMenu()` / `showMenu()` in a block in `[data-smore]`.
- Log sort order toggle (`#1081`): add `Oldest first` (default) / `Newest first` sorting across Container detail Logs, Compose project Logs, and Pod Logs across macOS, Windows, and Linux, preserving live streaming, scroll pinning, search/level filtering, and translations across all 41 locale files.
- Linux `fontconfig` WebKit stall recovery & doctor warning (`#1078`): add a 5-second startup watchdog in `gtk.rs` that detects a `WebKitWebProcess` startup stall with a populated user `~/.cache/fontconfig`, logs the cause to `ui.log`, records a cache fingerprint bypass stamp, and re-launches cleanly with `XDG_CACHE_HOME=~/.kiri/cache/ui`, restoring user `XDG_CACHE_HOME` for spawned terminals and surfacing an actionable `fc-cache -rf` warning in `kiri doctor`.
- Docs & fix registry (`#1080`): fix the relative link to `testing-windows-arm.md` in `docs/development.md` and record recent unreleased bug fixes in `docs/fix-registry.md`.

Fixes #1081
Fixes #1078
Closes #1062
Closes #1033
Closes #1080

Co-authored-by: shihh <shihao1016@qq.com>
Co-authored-by: AnuchitO <3372362+AnuchitO@users.noreply.github.com>
Co-authored-by: Bryan Lundberg <119996547+bryanlundberg@users.noreply.github.com>
2026-12-01 11:38:12 +01:00

64 lines
2.9 KiB
JavaScript

// parity: macos windows linux
// Regression coverage for type-checker-flagged window script fixes (#1033):
// setRail aria-pressed strings, dgTime invalid-date handling, and [data-smore] menu sequencing.
const R = [];
const t = (name, fn) => { try { fn(); R.push("PASS " + name); } catch (e) { R.push("FAIL " + name + ": " + e.message); } };
const eq = (a, b, m) => { if (JSON.stringify(a) !== JSON.stringify(b)) throw new Error(m + ": got " + JSON.stringify(a) + " want " + JSON.stringify(b)); };
t("setRail sets aria-pressed to exact string true or false", () => {
const b = document.getElementById("rail-toggle");
setRail(true);
eq(b.getAttribute("aria-pressed"), "false", "folded rail -> aria-pressed=false");
setRail(false);
eq(b.getAttribute("aria-pressed"), "true", "expanded sidebar -> aria-pressed=true");
});
t("dgTime preserves invalid timestamps and formats valid ISO timestamps with milliseconds", () => {
eq(dgTime("not-a-timestamp"), "not-a-timestamp", "invalid text");
eq(dgTime(""), "", "empty string");
const valid = dgTime("2026-11-29T12:34:56.007999Z");
if (!/\d{2}:\d{2}:\d{2}\.007$/.test(valid)) throw new Error("unexpected formatted time: " + valid);
});
t("clicking [data-smore] closes any open menu before opening the unmade service menu", () => {
kiri.on({
type: "lists",
containers: [{ Id: "c1", Names: ["/demo-web-1"], Image: "nginx:alpine", ImageID: "sha256:1", State: "running", Status: "Up 1m", Created: 1, Ports: [], Labels: { "com.docker.compose.project": "demo", "com.docker.compose.service": "web" } }],
images: [],
volumes: [],
networks: [],
});
kiri.on({
type: "composeprojects",
logos: {},
projects: [{
name: "demo",
dir: "/work/demo",
files: ["/work/demo/compose.yaml"],
readable: true,
containers: [{ service: "web", id: "c1", name: "demo-web-1", image: "nginx:alpine", state: "running", status: "Up 1m" }],
services: [
{ name: "web", image: "nginx:alpine" },
{ name: "worker", image: "alpine:3" },
],
}],
});
show("compose");
const cMore = document.querySelector('[data-more="c1"]');
cMore.click();
eq(document.querySelectorAll(".menu").length, 1, "container menu open");
const sMore = document.querySelector('[data-smore="demo"][data-svc="worker"]');
if (!sMore) throw new Error("missing [data-smore] button for unmade service");
sMore.click();
const menus = document.querySelectorAll(".menu");
eq(menus.length, 1, "previous menu closed before opening service menu");
eq([...menus[0].querySelectorAll("button")].map((b) => b.textContent.trim()), ["Open project", "Show in compose file"], "service menu items");
document.body.click();
eq(document.querySelectorAll(".menu").length, 0, "outside click closes menu");
});
R.push("ITEM rail-toggle aria-pressed=" + document.getElementById("rail-toggle").getAttribute("aria-pressed"));
report(R);