From a18ff505ba60bd5520e055a02e493af1c4d752ef Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 5 Nov 2026 05:39:39 +0800 Subject: [PATCH] gui tests: redact-words-list measures the drawn controls, not the closed Import box's (acmilan_ follow-up) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- internal/gui/tests/redact-words-list.test.cjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/gui/tests/redact-words-list.test.cjs b/internal/gui/tests/redact-words-list.test.cjs index 0b9b19ed7..e11667a64 100644 --- a/internal/gui/tests/redact-words-list.test.cjs +++ b/internal/gui/tests/redact-words-list.test.cjs @@ -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");