gui: the Gateway card's state sits centred on its title's line
The owner, on the Gateway page's status card: "这里没有水平对齐". The
state ("运行中", 11px) sat on the 15px title's baseline. A smaller run of
CJK text on a shared baseline reads as dropped below it: the title's ink
ran rows 40-61 of the screenshot and the state's 42-61, so the state's
middle was about a pixel low. .gw .name is now a flex row with
align-items: center and an 8px gap (as .mask-act .name already is). The
state keeps its ellipsis for long text (min-width: 0).
gateway-card.test.cjs now measures the title text's middle against the
state's and allows 0.25px.
Run:
- gateway-card.test.cjs, chromium on mote: 10 of 10 ok. WebKit on mote
hangs at browserType.launch right now (a bare webkit.launch timed out
at 60s, load ~30), so it ran on the Linux box (magpie-desktop): 10 of
10 ok.
- Broken by hand: the old app.css with the new test, both engines, 5
languages, 2 widths: 20 of 20 red, "the state's middle is 0.5px off
the title's".
- All 30 gateway GUI files at once on the Linux box, both engines: 299
ok, 1 red. The red was gateway-caller-keys webkit en:138, the
sideways-scroll read right after setViewportSize. That is #3797, now
commented on. It passed 3 of 3 alone on this branch and on origin/main
74f812eaf.
At the pushed head (rebased on 333e7f573): gateway-card and gateway-older
on the Linux box, 24 of 24 ok; go test ./internal/gui -run Budget|CSS|Asset
on mote ok.
Not tried: the whole GUI suite, and macOS WebKit (launch hangs on mote).
The change is two CSS rules scoped to .gw .name.
This commit is contained in:
@@ -2337,7 +2337,10 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
|
||||
.gw .gw-mark.on .led { fill: var(--green); }
|
||||
/* narrow, the fix button goes under the state rather than squeeze it */
|
||||
.gw .who { flex: 1 1 15em; min-width: 0; }
|
||||
.gw .name .state { margin-left: 8px; font-size: 11px; font-weight: 500; color: var(--green); }
|
||||
/* the state centred on the title's line, not sat on its baseline: a
|
||||
smaller run of CJK on the baseline reads as dropped below it */
|
||||
.gw .name { display: flex; align-items: center; gap: 8px; }
|
||||
.gw .name .state { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 500; color: var(--green); }
|
||||
.gw .gw-mark:not(.on) ~ .who .state { color: var(--amber); }
|
||||
.gw .sub.old { white-space: normal; overflow: visible; text-overflow: clip; }
|
||||
.gw .sub.err { color: var(--red); overflow-wrap: anywhere; }
|
||||
|
||||
@@ -47,6 +47,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
// the mark in its tile, the state beside it
|
||||
assert.equal(await page.locator("#gateway > .gw-mark.on svg .led").count(), 2, "the mark's two lights");
|
||||
assert.equal(await page.locator("#gateway .url").count(), 0, "no address pill in the status row");
|
||||
// the state centred on the title's line, not sat low on its baseline
|
||||
// (the owner: "没有水平对齐")
|
||||
const off = await page.locator("#gateway .name").evaluate((n) => {
|
||||
const r = document.createRange();
|
||||
r.selectNodeContents(n.firstChild);
|
||||
const a = r.getBoundingClientRect(), b = n.querySelector(".state").getBoundingClientRect();
|
||||
return Math.abs((a.top + a.bottom) / 2 - (b.top + b.bottom) / 2);
|
||||
});
|
||||
assert(off <= 0.25, `the state's middle is ${off}px off the title's`);
|
||||
// Connect folded by default, its base URL in its head
|
||||
assert.equal(await page.locator("#foldConnect").getAttribute("aria-expanded"), "false", "Connect starts folded");
|
||||
assert(await page.locator("#connect").evaluate((c) => c.hidden));
|
||||
|
||||
Reference in New Issue
Block a user