diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 4d21b5e63..400bc8706 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -3809,6 +3809,33 @@ input.words.compact-num { flex: none; width: 76px; font-variant-numeric: tabular .row.pref.redact-kind .sub { white-space: normal; overflow-wrap: anywhere; line-height: 1.45; } /* an update that failed says why in full (the version row) */ .row .sub.wraps { white-space: normal; overflow-wrap: anywhere; } +/* Settings' lines that explain a setting rest out of sight, so the page is + its names and controls (the owner, 11-02): the pointer resting on a row, + or a key reaching it, shows them in a card under its name + (settingshints.js), and the rows don't move. They stay read by a screen + reader and by the search, which shows them in place. What isn't an + explanation stays: an error, a state (.say: the Version row's update, + a sync's last sync, the local model's, a check-in's result; the proxy + in use; a pattern's matches), a warning, a disclosure (what tracing + sends, who the allow list lets in), a line with a button or link in + it. A touch screen, with no hover, keeps them all. */ +@media (hover: hover) { + #view-settings:not(.set-searching) .row.pref > .who > .sub:not(.err, .bad, .say, .proxy-check, .lib-way, .image-gen-hidden, .sync-sign-in, .no-names, .pv-hits, .feat-why, .vision-not-marked, .font-note, .acts, [role="status"], #proxySub):not(#otelSessionsRow *, #allowList *, .disabled-model *) { + --hint: 1; position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; + } + /* a row left with its name alone is as tall as any other: its control + (a switch, a field, a shortcut) no longer sets it apart */ + #view-settings .row.pref:not(.feat-set) { box-sizing: content-box; min-height: 27px; } /* 51 with its padding, a line above it outside */ + /* Check in now's result comes under its name and the row grows down, + its button held where it was pressed */ + #view-settings .ci-now-row { align-items: flex-start; } +} +.set-hint { position: fixed; z-index: 60; max-width: min(380px, calc(100vw - 32px)); padding: 8px 11px; border-radius: 9px; background: var(--pop-bg); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); font-size: 12px; line-height: 1.45; color: var(--fg-2); overflow-wrap: anywhere; pointer-events: none; opacity: 0; transform: translateY(-2px); transition: opacity .14s ease, transform .14s ease; } +.set-hint.on { opacity: 1; transform: none; } +.set-hint > p { margin: 0; } +.set-hint > p + p { margin-top: 4px; } +@media (prefers-reduced-motion: reduce) { .set-hint { transition: none; transform: none; } } +:root[data-motion="reduce"] .set-hint { transition: none; transform: none; } .prefs .val.rule-add { flex: 1 1 100%; max-width: none; margin-left: 0; gap: 6px; } input.words.rule-kind { flex: none; width: 110px; } input.words.gateway-port { flex: none; width: 110px; font-variant-numeric: tabular-nums; }input.words.rule-match { flex: 1 1 auto; width: auto; min-width: 0; } diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 607962f9f..9c583d1bb 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -19481,10 +19481,10 @@ function setSetTab(tab, remember) { if (b) setSetTab(b.dataset.set, true); }; tabKeys(tabs, "button[data-set]"); - // the tabs held at the top (app.css, #2396): a hairline under them once - // the page has scrolled beneath, as the Library's + // held tabs (#2396): a hairline once scrolled under const sv = $("#view-settings"), head = sv.querySelector(":scope > .set-head"); sv.addEventListener("scroll", () => head.classList.toggle("stuck", sv.scrollTop > 0), { passive: true }); + import("./settingshints.js").catch(() => {}); // opened on a part (a reload, a link): that part, and remembered if (mode === "window" && params.get("view") === "settings" && SET_TABS.includes(params.get("tab"))) { setTab = params.get("tab"); @@ -20031,6 +20031,7 @@ async function renderSync(v) { // a failure is shown whole: what the server sent and what to do don't // fit one line if (v.error) sub.classList.add("bad", "wraps"); + if (v.on) sub.classList.add("say"); // usage that couldn't be shared is a line of its own, in red: beside // "Synced" in the same grey it read as part of a sync that went fine // (#1259) @@ -20060,8 +20061,8 @@ async function renderSync(v) { else if (n.here?.length) lines.push(t("Replaced here by newer ones from another computer: {parts}", { parts: parts(n.here) })); if (n.there?.length) lines.push(t("Replaced on the server by this computer's newer ones: {parts}", { parts: parts(n.there) })); const who = el("div", "who"); - for (const l of lines) who.append(el("div", "sub", l)); - who.append(el("div", "sub", t(n.restored ? "This computer's setup from before is kept in the sync folder." : "The copies replaced are kept in the sync folder."))); + for (const l of lines) who.append(el("div", "sub say", l)); + who.append(el("div", "sub say", t(n.restored ? "This computer's setup from before is kept in the sync folder." : "The copies replaced are kept in the sync folder."))); const val = el("div", "val"); if (n.restored && v.undo) val.append(btn(t("Undo"), async (e) => { e.target.classList.add("busy"); @@ -21868,11 +21869,8 @@ function renderRedact(s, keep) { } } -// privacyModelRow: the local masking model (internal/pii), downloaded when -// it is turned on and then asked beside the rules. Its state is its own -// (privacy-model): read when the row is drawn, and each second while it -// downloads or starts. Under it, once the model can run, its threshold -// (pmScore). +// privacyModelRow: the local masking model (internal/pii); its state read +// on drawing, each second while it downloads or starts; then pmScore. let pmState = null, pmTimer = 0; function privacyModelRow(box, why) { const r = el("div", "row pref" + (why ? " pm-wait" : "")); @@ -21885,7 +21883,7 @@ function privacyModelRow(box, why) { if (why) { clearTimeout(pmTimer); const who = el("div", "who"); - who.append(name(), el("div", "sub", why)); + who.append(name(), el("div", "sub say", why)); r.append(who); return; } @@ -21893,7 +21891,7 @@ function privacyModelRow(box, why) { const draw = (m) => { if (!r.isConnected) return; const who = el("div", "who"), val = el("div", "val"); - who.append(name(), el("div", "sub", pmSub(m))); + who.append(name(), el("div", m && (m.on || m.installed || !m.supported || pmBusy(m) || m.error || m.models?.some((x) => x.error)) ? "sub say" : "sub", pmSub(m))); if (m?.supported || m?.installed) { if (m.models?.length > 1) val.append(pmPick(m, (id) => act("pick", id))); if (pmBusy(m)) { @@ -22358,7 +22356,7 @@ async function renderUpdate(r, u) { if (u == null) { const bare = !r.querySelector(".sub"), early = bare && !updateBusy && Date.now() - updateLast?.at < 3e4; if (early) renderUpdate(r, updateLast); - else if (bare) r.querySelector(".who").append(el("div", "sub", "\u00a0")); + else if (bare) r.querySelector(".who").append(el("div", "sub say", "\u00a0")); u = await api(updatePath("update?fresh=1")).catch(() => null); if (!u || !r.isConnected || seqOf(r) !== seq) return; if (early) updateSeq.set(r, seq + 1); // stops timers @@ -22366,6 +22364,7 @@ async function renderUpdate(r, u) { updateLast = u, u.at ??= Date.now(); const who = r.querySelector(".who"), val = r.querySelector(".val"); const sub = who.querySelector(".sub") || who.appendChild(el("div", "sub")); + sub.classList.add("say"); sub.title = ""; sub.classList.remove("wraps"); // the release page's button outlives a redraw: a download redraws every diff --git a/internal/gui/assets/checkinnow.js b/internal/gui/assets/checkinnow.js index 67b597c01..a78b6c551 100644 --- a/internal/gui/assets/checkinnow.js +++ b/internal/gui/assets/checkinnow.js @@ -22,6 +22,7 @@ window.ciNowFill = function (row, s, by) { const said = checkinNowSaid[by]; sub.textContent = said ? said.text : t("Checks one account in once now; the daily check-in's switches stay as they are"); sub.classList.toggle("err", !!said?.bad); + sub.classList.toggle("say", !!said); // what came of it: a state, kept in sight const b = el("button", "text ci-now-go", t(accts.length > 1 ? "Check in…" : "Check in")); b.type = "button"; b.disabled = !!said?.busy; diff --git a/internal/gui/assets/plugins/gateway/settings.js b/internal/gui/assets/plugins/gateway/settings.js index 437406a4d..5a2da7e0f 100644 --- a/internal/gui/assets/plugins/gateway/settings.js +++ b/internal/gui/assets/plugins/gateway/settings.js @@ -406,7 +406,7 @@ function renderWebPage(asked) { segs([["", t("Off")], ["local", t("This computer")], ["lan", t("Local network")]], s.mode || "", (mode) => set({ mode }))).classList.add("web-page-mode"); if (s.mode) { const why = s.error ? el("div", "sub err", s.error.startsWith("port ") ? t("Port {p} is taken by another program, magpie web perhaps: magpie tries again every few seconds", { p: s.port }) : t(s.error)) - : el("div", "sub", s.serving ? t("Served; anyone with this link can change every setting") : t("Starting…")); + : el("div", "sub say", s.serving ? t("Served; anyone with this link can change every setting") : t("Starting…")); const links = [s.link, ...(s.mode === "lan" ? s.network || [] : [])].filter(Boolean); const box2 = el("div", "web-page-links"); for (const l of links) { diff --git a/internal/gui/assets/settingshints.js b/internal/gui/assets/settingshints.js new file mode 100644 index 000000000..2d5127cca --- /dev/null +++ b/internal/gui/assets/settingshints.js @@ -0,0 +1,75 @@ +// Settings' explanations, shown on asking (the owner, 11-02: "让整个设计 +// 页面看起来很简洁,很有呼吸感"). app.css keeps a row's lines that explain +// it out of sight (--hint: 1 on each); the pointer resting on the row, or a +// key reaching it, shows them here in a card under the row's name, over +// the page, so no row moves. The card takes no pointer: a click goes to +// what is under it. It goes when the pointer or focus leaves the row, the +// page scrolls, a key is pressed or the row is drawn again. Imported by +// app.js when the pointer or focus first comes to Settings, not at start. +const view = document.getElementById("view-settings"); +const card = el("div", "set-hint"); +card.setAttribute("aria-hidden", "true"); // a screen reader reads the lines in the row +document.body.append(card); +let row = null, wait = 0; + +const acts = () => { + for (const s of view.querySelectorAll(".row.pref > .who > .sub")) s.classList.toggle("acts", !!s.querySelector("a, button, input, select, code, .searcher-failed")); +}; +// before the page is painted again: no frame shows such a line hidden +new MutationObserver(acts).observe(view, { childList: true, subtree: true }); +acts(); + +const hints = (r) => [...r.querySelectorAll(":scope > .who > .sub")] + .filter((s) => !s.hidden && getComputedStyle(s).getPropertyValue("--hint").trim() === "1" && s.textContent.trim()); + +function hide() { + clearTimeout(wait); + row = null; + card.classList.remove("on"); + card.hidden = true; +} +function show(r) { + const subs = r.isConnected && !view.hidden ? hints(r) : []; + if (!subs.length) return hide(); + card.replaceChildren(...subs.map((s) => el("p", "", s.textContent.trim()))); + card.hidden = false; + const who = r.querySelector(":scope > .who").getBoundingClientRect(), box = r.getBoundingClientRect(); + const w = card.offsetWidth, h = card.offsetHeight; + const left = Math.max(16, Math.min(who.left, innerWidth - 16 - w)); + // under the row, or over it where the window ends first + const top = box.bottom + 4 + h <= innerHeight - 8 ? box.bottom + 4 : Math.max(8, box.top - 4 - h); + card.style.left = left + "px"; + card.style.top = top + "px"; + requestAnimationFrame(() => row === r && card.classList.add("on")); +} +function point(r, now) { + if (r === row) return; + hide(); + if (!r) return; + row = r; + // a pointer passing over rows on its way shows nothing; resting does + wait = setTimeout(() => show(r), now ? 0 : 450); +} +const rowOf = (n) => n instanceof Element ? n.closest("#view-settings .row.pref") : null; +view.addEventListener("pointerover", (e) => e.pointerType !== "touch" && point(rowOf(e.target))); +view.addEventListener("pointerleave", () => hide()); +view.addEventListener("pointerdown", () => hide(), true); +view.addEventListener("focusin", (e) => { + let key = true; + try { key = e.target.matches(":focus-visible"); } catch {} // Safari before 15.4 + if (key) point(rowOf(e.target), true); +}); +view.addEventListener("focusout", (e) => { + if (!rowOf(e.relatedTarget) || rowOf(e.relatedTarget) !== row) hide(); +}); +// a scroll takes the pointer's card away; focus's follows its row, which +// a key moving focus scrolls into sight +view.addEventListener("scroll", () => row?.contains(document.activeElement) ? show(row) : hide(), { passive: true, capture: true }); +addEventListener("keydown", (e) => !/^(Tab|Shift|Alt|Meta|Control)$/.test(e.key) && hide(), true); +addEventListener("resize", hide); +hide(); +// the pointer already on a row, or focus, as the import came +{ + const on = view.querySelector(".row.pref:hover") || rowOf(document.activeElement); + if (on) point(on); +} diff --git a/internal/gui/tests/classify-timeout-setting.test.cjs b/internal/gui/tests/classify-timeout-setting.test.cjs index 907ef9400..e7765d1f4 100644 --- a/internal/gui/tests/classify-timeout-setting.test.cjs +++ b/internal/gui/tests/classify-timeout-setting.test.cjs @@ -75,7 +75,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", } assert.equal(await row.locator(".name").textContent(), w.name); assert((await row.locator(".sub").textContent()).includes(w.sub)); - for (const part of [".name", ".sub", ".segs"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", ".segs"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/claude-lean-prompt-setting.test.cjs b/internal/gui/tests/claude-lean-prompt-setting.test.cjs index 8e17893e3..b1e7269d9 100644 --- a/internal/gui/tests/claude-lean-prompt-setting.test.cjs +++ b/internal/gui/tests/claude-lean-prompt-setting.test.cjs @@ -73,7 +73,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await row.locator(".name").textContent(), w.name); const sub = await row.locator(".sub").textContent(); assert(sub.includes(w.sub) && sub.includes(w.risk), sub); - for (const part of [".name", ".sub", ".segs"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", ".segs"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/claude-tui-setting.test.cjs b/internal/gui/tests/claude-tui-setting.test.cjs index 92fd4e646..fcdb302f6 100644 --- a/internal/gui/tests/claude-tui-setting.test.cjs +++ b/internal/gui/tests/claude-tui-setting.test.cjs @@ -75,7 +75,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await row.locator(".name").textContent(), w.name); const sub = await row.locator(".sub").textContent(); assert(sub.includes(w.sub) && sub.includes(w.risk), sub); - for (const part of [".name", ".sub", ".segs"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", ".segs"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/disabled-models.test.cjs b/internal/gui/tests/disabled-models.test.cjs index 26d6993ee..09c44137f 100644 --- a/internal/gui/tests/disabled-models.test.cjs +++ b/internal/gui/tests/disabled-models.test.cjs @@ -2,7 +2,8 @@ // Settings › Models › Disabled models (#1867, oxsean: a model the user // never wants, claude-fable-5, kept being reached through a group, a // fallback and an old session): the list says what it covers — only -// requests through magpie — each pattern with the models it turns off +// requests through magpie, on hover, as Settings' explanations are (the +// owner, 11-02) — each pattern with the models it turns off // now and Enable; Disable… takes a model from the picker or a glob typed // into it. Each saves the whole list on its own route, the page not moved // by the click. In English, Chinese, Japanese and German, 1100 and 420 wide. @@ -92,10 +93,14 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await fable.locator(".sub").textContent(), w.hits); for (const part of [`#disabledAddRow .name`, `#disabledAddRow .sub`, `#disabledAdd`, `.disabled-model .name`, `.disabled-model .sub`, `.disabled-model button`]) { const fit = await page.locator("#disabledModelsList " + part).first().evaluate((e) => { + // the add row's line explains it: out of sight at rest, whole in + // the hover card (settings-hints.test.cjs) + if (getComputedStyle(e).getPropertyValue("--hint").trim() === "1") return "hint"; const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; }); - assert(fit, `${part} fits at ${width}`); + if (part === "#disabledAddRow .sub") assert.equal(fit, "hint", `${part} shows at rest at ${width}`); + else assert.equal(fit, true, `${part} fits at ${width}`); } // Disable…: a glob typed into the picker is taken as typed diff --git a/internal/gui/tests/image-timeout-setting.test.cjs b/internal/gui/tests/image-timeout-setting.test.cjs index 83b964446..2abcc0ce7 100644 --- a/internal/gui/tests/image-timeout-setting.test.cjs +++ b/internal/gui/tests/image-timeout-setting.test.cjs @@ -80,7 +80,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", } assert.equal(await row.locator(".name").textContent(), w.name); assert((await row.locator(".sub").textContent()).includes(w.sub)); - for (const part of [".name", ".sub", ".segs"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", ".segs"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/images-codex-one.test.cjs b/internal/gui/tests/images-codex-one.test.cjs index 63727e08a..979d11704 100644 --- a/internal/gui/tests/images-codex-one.test.cjs +++ b/internal/gui/tests/images-codex-one.test.cjs @@ -2,7 +2,8 @@ // #1865: chatgpt.com's Codex images backend draws the same image for // gpt-image-2, gpt-image-2.5 or a made-up name, so Settings › Models › // Image generation lists a ChatGPT account's one GPT Image, its note saying -// ChatGPT picks the model, and the row says so while it draws. Before, it +// ChatGPT picks the model, and the row says so while it draws (in its +// hover card: the line explaining it rests out of sight). Before, it // listed GPT Image 2 and 2.5 as if they differed. A gpt-image-2.5 saved // when it was listed (imageGenShown) shows as that entry, is ticked in the // picker, and picking that entry again saves nothing over it. An API key's @@ -108,14 +109,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const button = draw.locator("button.rt-cond"); assert.equal((await button.textContent()).trim(), "GPT Image · Codex"); const line = draw.locator(".image-gen-vendor"); - assert.equal(await line.isVisible(), true); + // the line explains the list: it rests out of sight, shown whole in the + // row's hover card (settings-hints.test.cjs) + assert.equal(await line.evaluate((e) => e.isConnected && getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); assert.match((await line.textContent()).trim(), want[lang].vendor); assert.equal(await draw.locator(".image-gen-missing").count(), 0); const fit = await page.evaluate(() => { - const l = document.querySelector("#imagesList .image-gen-vendor"), row = l.closest(".row").getBoundingClientRect(), r = l.getBoundingClientRect(); - return { inRow: r.left >= row.left - 1 && r.right <= row.right + 1, scroll: document.documentElement.scrollWidth - document.documentElement.clientWidth }; + return { scroll: document.documentElement.scrollWidth - document.documentElement.clientWidth }; }); - assert.deepEqual(fit, { inRow: true, scroll: 0 }); + assert.deepEqual(fit, { scroll: 0 }); shots.push([`${lang}-${width}`, await page.screenshot({ fullPage: true })]); await click(page, button); diff --git a/internal/gui/tests/loop-guard-setting.test.cjs b/internal/gui/tests/loop-guard-setting.test.cjs index 533202c0d..d5e4b2dcf 100644 --- a/internal/gui/tests/loop-guard-setting.test.cjs +++ b/internal/gui/tests/loop-guard-setting.test.cjs @@ -74,7 +74,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", } assert.equal(await row.locator(".name").textContent(), w.name); assert((await row.locator(".sub").textContent()).includes(w.sub)); - for (const part of [".name", ".sub", ".segs"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", ".segs"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/old-webkit.test.cjs b/internal/gui/tests/old-webkit.test.cjs index 02446b21b..f136d3f57 100644 --- a/internal/gui/tests/old-webkit.test.cjs +++ b/internal/gui/tests/old-webkit.test.cjs @@ -156,7 +156,7 @@ test("compat.js is the first of the page's own scripts", async () => { // Sync, scrollends.js on the window's first scroll, profilerename.js // when a saved profile's Rename is pressed; the checks above // still read them - for (const f of await scripts()) if (!["webfonts.js", "cfgblocked.js", "signsheets.js", "ruleedit.js", "ratewindows.js", "traywindows.js", "autoresetown.js", "registry.js", "navlamp.js", "whatsnew.js", "claudemode.js", "ctxtext.js", "resetask.js", "quotaall.js", "quitask.js", "checkinnow.js", "autobackup.js", "scrollends.js", "profilerename.js"].includes(f)) assert(all.includes(f), f + " is not loaded by index.html"); + for (const f of await scripts()) if (!["webfonts.js", "cfgblocked.js", "signsheets.js", "ruleedit.js", "ratewindows.js", "traywindows.js", "autoresetown.js", "registry.js", "navlamp.js", "whatsnew.js", "claudemode.js", "ctxtext.js", "resetask.js", "quotaall.js", "quitask.js", "checkinnow.js", "autobackup.js", "scrollends.js", "profilerename.js", "settingshints.js"].includes(f)) assert(all.includes(f), f + " is not loaded by index.html"); }); test("the styles hold up in Safari 15.0", async () => { diff --git a/internal/gui/tests/privacy-model.test.cjs b/internal/gui/tests/privacy-model.test.cjs index 16557976b..038f22713 100644 --- a/internal/gui/tests/privacy-model.test.cjs +++ b/internal/gui/tests/privacy-model.test.cjs @@ -2,9 +2,11 @@ // Settings → Privacy's local masking model (#1977): a row under the masking // switches, there while either is on. On downloads the model, its progress // shown and a Cancel beside it; once it is on, the row says where it runs. -// Off, a downloaded model can be deleted, after asking. Its words are shown -// in full, in every language, in a wide window and a narrow one, and a -// click moves nothing. Under it, the model's threshold is picked from the +// Off, a downloaded model can be deleted, after asking. What it says while +// downloading or on is a state, shown in full; off, its line explains it +// and rests out of sight, for the hover card (settingshints.js), as the +// threshold's does. In every language, in a wide window and a narrow one, +// and a click moves nothing. Under it, the model's threshold is picked from the // app's menu too. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); @@ -110,8 +112,9 @@ const runs = { failed: { device: "CPU", gpuError: "prediction failed" }, cpu: { device: "CPU" }, }; -// what the row shows: its words and its New mark, whether they are cut, -// that it is inside the list, and that it is the page's first setting +// what the row shows: its words and its New mark, whether they rest out of +// sight for the hover card (hint) or are cut, that it is inside the list, +// and that it is the page's first setting const look = (page) => page.evaluate(() => { const r = document.querySelector("#privacyModelRow"), list = r.closest(".list").getBoundingClientRect(); const sub = r.querySelector(".sub"), b = r.getBoundingClientRect(), v = r.querySelector(".val").getBoundingClientRect(); @@ -119,6 +122,7 @@ const look = (page) => page.evaluate(() => { name: r.querySelector(".name").firstChild.textContent, badge: r.querySelector(".name .badge.new")?.textContent, sub: sub.textContent, first: r === document.querySelector("#setPage-privacy .list.prefs > .row"), on: r.querySelector(".segs .opt.on")?.textContent, buttons: [...r.querySelectorAll("button.text")].map((x) => x.textContent), + hint: getComputedStyle(sub).getPropertyValue("--hint").trim() === "1", cut: sub.scrollWidth > sub.clientWidth + 1 || sub.scrollHeight > sub.clientHeight + 1, inside: b.left >= list.left - 1 && b.right <= list.right + 1 && v.right <= b.right + 1, wide: document.documentElement.scrollWidth > document.documentElement.clientWidth, @@ -141,7 +145,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert(m.first, "the model is the first setting under the card"); assert(m.sub.includes("1.6 GB"), `says what it downloads: ${m.sub}`); if (lang !== "en") assert(!/no rule can find|Turning it on/.test(m.sub), `translated: ${m.sub}`); - assert(!m.cut && m.inside && !m.wide, `shown in full and inside: ${JSON.stringify(m)}`); + assert(m.hint && m.inside && !m.wide, `off, the explanation rests out of sight, for the hover card: ${JSON.stringify(m)}`); await page.mouse.move(width / 2, 300); for (let i = 0; i < 20 && (await row.boundingBox()).y > 900; i++) { @@ -157,12 +161,12 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", m = await look(page); assert.equal(m.buttons.length, 1, "a Cancel while it downloads"); assert.equal(m.on, w.on); - assert(!m.cut && m.inside && !m.wide, `shown in full and inside: ${JSON.stringify(m)}`); + assert(!m.hint && !m.cut && m.inside && !m.wide, `the download's progress shown in full and inside: ${JSON.stringify(m)}`); // then on, on the GPU await page.waitForFunction((want) => document.querySelector("#privacyModelRow .sub").textContent === want, w.gpu); m = await look(page); assert.deepEqual(m.buttons, [], "nothing to cancel or delete while it is on"); - assert(!m.cut && m.inside && !m.wide, `shown in full and inside: ${JSON.stringify(m)}`); + assert(!m.hint && !m.cut && m.inside && !m.wide, `shown in full and inside: ${JSON.stringify(m)}`); assert.deepEqual(posts, ["on"]); assert.deepEqual(await page.evaluate(() => [scrollX, scrollY, document.querySelector("#view-settings").scrollTop]), before, "the click moved nothing"); assert.deepEqual(errors, []); @@ -180,7 +184,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const m = await look(page); await browser.close(); assert.equal(m.sub, runWords[lang][k], k); - assert(!m.cut && m.inside && !m.wide, `${k} shown in full and inside: ${JSON.stringify(m)}`); + assert(!m.hint && !m.cut && m.inside && !m.wide, `${k} shown in full and inside: ${JSON.stringify(m)}`); assert.deepEqual(errors, []); } }); @@ -248,7 +252,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await page.locator("#privacyModelRow select").count(), 0, "no native select"); assert.equal((await pick.textContent()).trim(), "Privacy Filter"); let m = await look(page); - assert(!m.cut && m.inside && !m.wide, `shown in full and inside: ${JSON.stringify(m)}`); + assert(!m.hint && !m.cut && m.inside && !m.wide, `where it runs shown in full and inside: ${JSON.stringify(m)}`); // the menu and the switch are two boxes: they stand apart, on one line const gap = await page.evaluate(() => { const p = document.querySelector("#privacyModelRow .pm-model").getBoundingClientRect(), s = document.querySelector("#privacyModelRow .segs").getBoundingClientRect(); @@ -298,6 +302,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const sub = r.querySelector(".sub"), b = r.getBoundingClientRect(), list = r.closest(".list").getBoundingClientRect(); return { name: r.querySelector(".name").textContent, sub: sub.textContent, pick: r.querySelector("button.pm-score").textContent.trim(), + hint: getComputedStyle(sub).getPropertyValue("--hint").trim() === "1", cut: sub.scrollWidth > sub.clientWidth + 1 || sub.scrollHeight > sub.clientHeight + 1, inside: b.left >= list.left - 1 && b.right <= list.right + 1, wide: document.documentElement.scrollWidth > document.documentElement.clientWidth, }; @@ -306,7 +311,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(m.name, w.name); if (lang !== "en") assert(!/less sure/.test(m.sub), `translated: ${m.sub}`); assert.equal(m.pick, "0.8"); - assert(!m.cut && m.inside && !m.wide, `shown in full and inside: ${JSON.stringify(m)}`); + assert(m.hint && m.inside && !m.wide, `the threshold's explanation rests out of sight, for the hover card: ${JSON.stringify(m)}`); const before = await page.evaluate(() => [scrollX, scrollY, document.querySelector("#view-settings").scrollTop]); const menu = page.locator(".proto-menu"); const items = async () => { diff --git a/internal/gui/tests/quit-ask-setting.test.cjs b/internal/gui/tests/quit-ask-setting.test.cjs index bbaa37fb0..431e82181 100644 --- a/internal/gui/tests/quit-ask-setting.test.cjs +++ b/internal/gui/tests/quit-ask-setting.test.cjs @@ -92,7 +92,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await reach(page, row); assert.equal(await row.locator(".name").textContent(), w.name); assert.ok((await row.locator(".sub").textContent()).includes(w.sub)); - for (const part of [".name", ".sub", ".segs"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", ".segs"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.left >= 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/redact-kinds.test.cjs b/internal/gui/tests/redact-kinds.test.cjs index 9815ce9eb..ac19dd8b7 100644 --- a/internal/gui/tests/redact-kinds.test.cjs +++ b/internal/gui/tests/redact-kinds.test.cjs @@ -2,8 +2,9 @@ // Settings' kinds of personal data (lc on Discord): under Mask personal data, // while it is on, a row for each kind with Off/On, showing the user's choice // or the kind's default; a click saves that kind alone with the rest of the -// settings as they were, and moves nothing. Their words are shown in full and -// nothing runs off the page. In every language, in a wide window and a +// settings as they were, and moves nothing. Their words are shown in full, +// or, where they only explain the kind, rest out of sight for the hover +// card (settingshints.js), and nothing runs off the page. In every language, in a wide window and a // narrow one. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); @@ -91,6 +92,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", return { id: r.dataset.redact, name: r.querySelector(".name").textContent, sub: sub.textContent, on: r.querySelector(".segs .opt.on")?.textContent, + hint: getComputedStyle(sub).getPropertyValue("--hint").trim() === "1", cut: sub.scrollWidth > sub.clientWidth + 1 || sub.scrollHeight > sub.clientHeight + 1, inside: b.left >= list.left - 1 && b.right <= list.right + 1 && v.right <= b.right + 1, }; @@ -106,7 +108,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.deepEqual(Object.fromEntries(m.rows.map((r) => [r.id, r.on === onWord ? "on" : "off"])), want); assert.equal(m.rows.find((r) => r.id === "ip").name, w.ip); for (const r of m.rows) { - assert(r.sub.length > 4 && !r.cut, `${r.id}'s words shown in full: ${r.sub}`); + assert(r.sub.length > 4 && (r.hint || !r.cut), `${r.id}'s words shown in full, or kept for the hover card: ${r.sub}`); assert(r.inside, `${r.id} inside the list`); if (lang !== "en" && r.id !== "iban") assert.notEqual(r.name, english[r.id], `${r.id} translated`); if (lang !== "en") assert.notEqual(r.sub, englishSub[r.id], `${r.id}'s words translated`); diff --git a/internal/gui/tests/redact-rule-edit.test.cjs b/internal/gui/tests/redact-rule-edit.test.cjs index d0ed94dc4..cb8fe28fa 100644 --- a/internal/gui/tests/redact-rule-edit.test.cjs +++ b/internal/gui/tests/redact-rule-edit.test.cjs @@ -3,7 +3,8 @@ // 只有移除,能否增加一个编辑功能): each rule's row has Edit beside Remove. // Edit opens the rule in its own row, where it stands, with its name, prefix // or regex and what it matches filled in, the fields on a line under its -// words, none on top of another. Cancel changes nothing and sends nothing. +// words (its name, where its explanation rests out of sight for the hover +// card), none on top of another. Cancel changes nothing and sends nothing. // A pattern the gateway refuses is said in the row, what was typed kept and // the rule as it was; a good one is saved in the same place. No click moves // the page. In every language, in a wide window and a narrow one. @@ -110,7 +111,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // its fields on a line under its words, inside the row, none on top of another const m = await ed.evaluate((r) => { const box = (e) => { const b = e.getBoundingClientRect(); return { l: b.left, r: b.right, t: b.top, b: b.bottom, mid: (b.top + b.bottom) / 2, w: b.width }; }; - return { row: box(r), sub: box(r.querySelector(".sub")), tools: [...r.querySelectorAll(".val input, .val .segs, .val button:not(.opt)")].map((e) => ({ cls: e.className, ...box(e) })), pageW: document.documentElement.scrollWidth, winW: innerWidth }; + const sub = r.querySelector(".sub"), words = getComputedStyle(sub).getPropertyValue("--hint").trim() === "1" ? r.querySelector(".name") : sub; + return { row: box(r), sub: box(words), tools: [...r.querySelectorAll(".val input, .val .segs, .val button:not(.opt)")].map((e) => ({ cls: e.className, ...box(e) })), pageW: document.documentElement.scrollWidth, winW: innerWidth }; }); assert.deepEqual(m.tools.map((e) => e.cls.split(" ")[0]), ["words", "segs", "words", "text", "text"], "name, prefix or regex, match, Save, Cancel"); for (const e of m.tools) assert(e.w > 0 && e.l >= m.row.l - 1 && e.r <= m.row.r + 1, `in the row: ${JSON.stringify(m)}`); diff --git a/internal/gui/tests/redact-rule-row.test.cjs b/internal/gui/tests/redact-rule-row.test.cjs index 9abb501ef..79ce43399 100644 --- a/internal/gui/tests/redact-rule-row.test.cjs +++ b/internal/gui/tests/redact-rule-row.test.cjs @@ -1,7 +1,8 @@ // Run with Node's test runner and Playwright on the module path; see README.md. // Settings' Masking rules row (TechVerser on X: 这个地方错位了吗?): its words -// are shown in full, and its fields — a name, prefix or regex, what to match, -// Add — sit on one line under them, from the row's left edge to its right, +// rest out of sight for the hover card (settingshints.js), and its fields — +// a name, prefix or regex, what to match, Add — sit on one line under its +// name, from the row's left edge to its right, // none on top of another, the rules already added listed after it as before. // In English and Chinese, in a wide window and a narrow one. const assert = require("node:assert/strict"); @@ -64,19 +65,19 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const val = r.querySelector(".val"); return { name: r.querySelector(".name").textContent, sub: sub.textContent, - cut: sub.scrollWidth > sub.clientWidth + 1 || sub.scrollHeight > sub.clientHeight + 1, - who: box(r.querySelector(".who")), val: box(val), subBox: box(sub), + hint: getComputedStyle(sub).getPropertyValue("--hint").trim() === "1", + who: box(r.querySelector(".who")), val: box(val), nameBox: box(r.querySelector(".name")), tools: [...val.children].map((e) => ({ cls: e.className, ...box(e) })), }; }); assert.equal(m.name, w.name); assert(m.sub.includes(w.sub) && m.sub.length > 20, `the row's words: ${m.sub}`); - assert(!m.cut, "the row's words are shown in full"); + assert(m.hint, "the row's words rest out of sight, for the hover card"); assert.deepEqual(m.tools.map((e) => e.cls.split(" ")[0]), ["words", "segs", "words", "text"], "name, prefix or regex, match, Add"); const mid = m.tools[0].mid; for (const e of m.tools) assert(Math.abs(e.mid - mid) < 2, `on one line: ${JSON.stringify(m.tools)}`); for (let i = 1; i < m.tools.length; i++) assert(m.tools[i].l >= m.tools[i - 1].r, `none on top of another: ${JSON.stringify(m.tools)}`); - assert(m.tools[0].t >= m.subBox.b, "the fields are under the words"); + assert(m.tools[0].t >= m.nameBox.b, "the fields are under the name"); assert(Math.abs(m.tools[0].l - m.who.l) < 1.5, `from the row's left edge: ${m.tools[0].l} vs ${m.who.l}`); assert(Math.abs(m.tools[3].r - m.val.r) < 1.5, `to its right: ${m.tools[3].r} vs ${m.val.r}`); diff --git a/internal/gui/tests/redact-shape.test.cjs b/internal/gui/tests/redact-shape.test.cjs index fc6a849e0..2228baad1 100644 --- a/internal/gui/tests/redact-shape.test.cjs +++ b/internal/gui/tests/redact-shape.test.cjs @@ -76,7 +76,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", name: r.querySelector(".name").textContent, sub: sub.textContent, on: r.querySelector(".segs .opt.on")?.textContent, first: r.previousElementSibling?.querySelector(".name")?.textContent === t("Mask secrets"), - cut: sub.scrollWidth > sub.clientWidth + 1 || sub.scrollHeight > sub.clientHeight + 1, + hint: getComputedStyle(sub).getPropertyValue("--hint").trim() === "1", inside: b.left >= list.left - 1 && b.right <= list.right + 1, wide: document.documentElement.scrollWidth > document.documentElement.clientWidth, }; @@ -84,7 +84,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(m.name, w.name); assert.equal(m.on, w.off, "off unless the user turned it on"); assert(m.first, "right under Mask secrets"); - assert(!m.cut && m.inside && !m.wide, "shown in full, inside the page"); + assert(m.hint && m.inside && !m.wide, "its explanation rests out of sight, for the hover card, inside the page"); if (lang !== "en") assert(!m.sub.includes("made-up"), "its words translated"); const before = await page.evaluate(() => [scrollX, scrollY, document.querySelector("#view-settings").scrollTop]); diff --git a/internal/gui/tests/redact-words-any-case.test.cjs b/internal/gui/tests/redact-words-any-case.test.cjs index 19250b6fc..df1393329 100644 --- a/internal/gui/tests/redact-words-any-case.test.cjs +++ b/internal/gui/tests/redact-words-any-case.test.cjs @@ -74,7 +74,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", on: r.querySelector(".segs .opt.on")?.textContent, // right under the words themselves after: r.previousElementSibling?.querySelector("input.words") != null, - cut: sub.scrollWidth > sub.clientWidth + 1 || sub.scrollHeight > sub.clientHeight + 1, + hint: getComputedStyle(sub).getPropertyValue("--hint").trim() === "1", inside: b.left >= list.left - 1 && b.right <= list.right + 1, wide: document.documentElement.scrollWidth > document.documentElement.clientWidth, }; @@ -82,7 +82,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(m.name, w.name); assert.equal(m.on, w.off, "off unless the user turned it on"); assert(m.after, "under Masked words"); - assert(!m.cut && m.inside && !m.wide, "shown in full, inside the page"); + assert(m.hint && m.inside && !m.wide, "its explanation rests out of sight, for the hover card, inside the page"); if (lang !== "en") assert(!m.sub.includes("A word also matches"), "its words translated"); const before = await page.evaluate(() => [scrollX, scrollY, document.querySelector("#view-settings").scrollTop]); diff --git a/internal/gui/tests/redact-words-whole.test.cjs b/internal/gui/tests/redact-words-whole.test.cjs index 937db5141..d3306ab0b 100644 --- a/internal/gui/tests/redact-words-whole.test.cjs +++ b/internal/gui/tests/redact-words-whole.test.cjs @@ -74,7 +74,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", on: r.querySelector(".segs .opt.on")?.textContent, // right under Masked words in any case after: r.previousElementSibling?.id === "redactWordsAnyCaseRow", - cut: sub.scrollWidth > sub.clientWidth + 1 || sub.scrollHeight > sub.clientHeight + 1, + hint: getComputedStyle(sub).getPropertyValue("--hint").trim() === "1", inside: b.left >= list.left - 1 && b.right <= list.right + 1, wide: document.documentElement.scrollWidth > document.documentElement.clientWidth, }; @@ -82,7 +82,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(m.name, w.name); assert.equal(m.on, w.off, "off unless the user turned it on"); assert(m.after, "under Masked words in any case"); - assert(!m.cut && m.inside && !m.wide, "shown in full, inside the page"); + assert(m.hint && m.inside && !m.wide, "its explanation rests out of sight, for the hover card, inside the page"); if (lang !== "en") assert(!m.sub.includes("A word is not masked"), "its words translated"); const before = await page.evaluate(() => [scrollX, scrollY, document.querySelector("#view-settings").scrollTop]); diff --git a/internal/gui/tests/refusal-retries-setting.test.cjs b/internal/gui/tests/refusal-retries-setting.test.cjs index 562dbf4a3..556bd96a0 100644 --- a/internal/gui/tests/refusal-retries-setting.test.cjs +++ b/internal/gui/tests/refusal-retries-setting.test.cjs @@ -76,7 +76,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", } assert.equal(await row.locator(".name").textContent(), w.name); assert((await row.locator(".sub").textContent()).includes(w.sub)); - for (const part of [".name", ".sub", ".segs"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", ".segs"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/reply-model-setting.test.cjs b/internal/gui/tests/reply-model-setting.test.cjs index 5efee6357..7d45dd032 100644 --- a/internal/gui/tests/reply-model-setting.test.cjs +++ b/internal/gui/tests/reply-model-setting.test.cjs @@ -99,7 +99,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await page.locator("#replyList").evaluate((l) => l.previousElementSibling.textContent.trim()), w.head); assert.equal(await row.locator("select").count(), 0, "no native select"); assert.equal((await row.locator("button.sess-pick").textContent()).trim(), w.member, "memberModel on shows the member"); - for (const part of [".name", ".sub", "button.sess-pick"]) { + // its explanation rests out of sight, shown whole in the row's hover card + // (settings-hints.test.cjs) + assert.equal(await row.locator(".sub").first().evaluate((e) => getComputedStyle(e).getPropertyValue("--hint").trim()), "1", "the explanation shows at rest"); + for (const part of [".name", "button.sess-pick"]) { const fit = await row.locator(part).first().evaluate((e) => { const r = e.getBoundingClientRect(); return e.scrollWidth <= e.clientWidth + 1 && r.width > 0 && r.right <= innerWidth + 1; diff --git a/internal/gui/tests/searcher-pick.test.cjs b/internal/gui/tests/searcher-pick.test.cjs index 231e07d63..9fc481422 100644 --- a/internal/gui/tests/searcher-pick.test.cjs +++ b/internal/gui/tests/searcher-pick.test.cjs @@ -14,9 +14,10 @@ // keeps the pick (prefsKeep). No click moves the page. English and Chinese, Chromium and // WebKit, with the API faked. Search help covers costs for every provider and // explains current eligibility without claiming a provider can never search. -// The help is also checked in Japanese and German, wrapped whole beside the -// picker at every width (arculongus on Discord: cut with an ellipsis on the -// desktop, it couldn't be read; settings-lines-wrap.test.cjs). +// The help is also checked in Japanese and German, whole in the hover card +// at every width (the owner, 11-02: a row's explanation rests out of sight; +// before, it wrapped whole beside the picker, arculongus on Discord: cut +// with an ellipsis on the desktop, it couldn't be read). const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); const path = require("node:path"); @@ -355,6 +356,18 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await row.locator(".searcher-relays").innerText(), h.relays); assert.equal(await row.locator(".searcher-left-out").innerText(), h.left); assert.equal(await row.locator("button.searcher-pick").innerText(), "Claude Haiku 4.5 · MyRelay"); + const sub = row.locator(".sub"); + assert.equal(await sub.getAttribute("class"), "sub", "every setting row's line wraps, with no class of its own to opt in"); + // the help explains the row: it rests out of sight and the + // pointer on the row shows it whole in the card (the owner, + // 11-02; settings-hints.test.cjs), the hover above showing it + if (await sub.evaluate((s) => getComputedStyle(s).getPropertyValue("--hint").trim() === "1")) { + const card = page.locator(".set-hint.on"); + await card.waitFor(); + assert((await card.innerText()).includes(h.help), "the card has the help"); + assert((await card.innerText()).includes(h.relays), "the card has the relays"); + continue; + } const layout = await row.evaluate((r) => { const sub = r.querySelector(".sub"); const b = r.querySelector("button.searcher-pick").getBoundingClientRect(); @@ -367,8 +380,6 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", (s.right <= b.left + 1 || s.bottom <= b.top + 1) }; }); assert(layout.clipped <= 1 && layout.fits, JSON.stringify(layout)); - const sub = row.locator(".sub"); - assert.equal(await sub.getAttribute("class"), "sub", "every setting row's line wraps, with no class of its own to opt in"); assert.equal(layout.whiteSpace, "normal", "the help wraps"); assert(layout.overflow <= 1, JSON.stringify(layout)); if (process.env.ARTIFACT_DIR) { diff --git a/internal/gui/tests/settings-general.test.cjs b/internal/gui/tests/settings-general.test.cjs index 9e47971a2..3e61331ab 100644 --- a/internal/gui/tests/settings-general.test.cjs +++ b/internal/gui/tests/settings-general.test.cjs @@ -7,7 +7,9 @@ // rows show only there), with the API faked: // - the rows whose names say enough have no line under them, and the lines // kept are never cut short, one line each on a wide window (narrower, -// they wrap whole beside the control: arculongus on Discord); +// they wrap whole beside the control: arculongus on Discord); a line +// that explains its row rests out of sight and shows whole in the +// hover card instead (the owner, 11-02; settings-hints.test.cjs); // - Codex's and Claude Code's own settings aren't here: they are on the // agents' rows (the owner, 10-20); // - Language is a button (never a native