gui tests: redact-words-list measures the drawn controls, not the closed Import box's (acmilan_ follow-up)

v0.1.2964 (eeecd4150) added an Import… box to the word lists. Closed, its
textarea and buttons are hidden and have no box, so "every row fits the
page" read their zero rects as past the edge: red 20/20 in the whole GUI
run on mote. The test now checks only controls with client rects.

Run on mote at origin/main 76f00399c with this change:
node --test --test-concurrency=3 internal/gui/tests/redact-*.test.cjs,
186/186 ok (Chromium and WebKit, narrow widths, every language).
Broken by hand: the check still fails when a drawn control is pushed past
the list's edge.
Not tried: the whole GUI suite again (the earlier run was cut short when
the mote connection dropped).
This commit is contained in:
yetone
2026-11-05 05:39:39 +08:00
parent 76f00399c5
commit a18ff505ba
@@ -75,7 +75,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.deepEqual(saved, [], "opening the page saves nothing");
const fit = await page.evaluate((sel) => {
const l = document.querySelector("#redactList").getBoundingClientRect();
return [...document.querySelectorAll(`${sel} input, ${sel} button`)].every((n) => { const b = n.getBoundingClientRect(); return b.left >= l.left - 1 && b.right <= l.right + 1; })
// what is drawn: the closed Import… box's controls have no box
return [...document.querySelectorAll(`${sel} input, ${sel} button`)].filter((n) => n.getClientRects().length).every((n) => { const b = n.getBoundingClientRect(); return b.left >= l.left - 1 && b.right <= l.right + 1; })
&& document.documentElement.scrollWidth <= document.documentElement.clientWidth;
}, LIST);
assert(fit, "every row fits the page");