diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index d85470c0b..40eb7948a 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -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; } diff --git a/internal/gui/tests/gateway-card.test.cjs b/internal/gui/tests/gateway-card.test.cjs index 31c0d0569..db9a34b4f 100644 --- a/internal/gui/tests/gateway-card.test.cjs +++ b/internal/gui/tests/gateway-card.test.cjs @@ -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));