usage: a sessions bar's name takes the width it needs, its bar what is left (John on Discord: widened, the names stayed cut short with … while the bars grew) — the Sessions overview's projects, models, tools and skills rows held their names to 9em, 10em and 11em whatever the window's width, every extra pixel going to the bar. Each card is now one grid whose rows are subgrids: the names' column is as wide as the longest (minmax(0, max-content)), the bars take the rest and are never under 5em, and every row's bar starts at the same place; narrow, the names are shortened rather than a bar. Without subgrid (before Safari 16) each row sizes its own name the same way. sessions-bar-names.test.cjs fails without the change (196px name shown in 108px at 1600 wide); it, sessions-overview, sessions-calendar-fill, sessions-today, click-scroll and old-webkit pass in Chromium and WebKit, en and zh.

This commit is contained in:
yetone
2026-10-01 23:20:56 +08:00
parent cbf51ec7a4
commit 41dde238dd
4 changed files with 167 additions and 9 deletions
+21 -7
View File
@@ -808,8 +808,13 @@ details.cx-part[open] > summary .cx-h { margin-bottom: 2px; }
.sess-card-foot .grow { flex: 1; }
.sess-none { color: var(--faint); font-size: 12px; padding: 18px 0; text-align: center; margin: auto 0; }
.sess-more { font-size: 11px; color: var(--faint); padding: 4px 2px 0; }
.sess-bars { display: flex; flex-direction: column; gap: 1px; }
.sess-bar { display: grid; grid-template-columns: minmax(0, 9em) minmax(0, 1fr) auto 4.2em; align-items: center; gap: 10px; height: 26px; padding: 0 6px; margin: 0 -6px; border: 0; border-radius: 6px; background: none; color: var(--fg-2); font: inherit; font-size: 12px; text-align: left; cursor: default; }
/* a card of bars is one grid: its names take the width the longest needs
and the bars what is left, every row's bar starting at the same place;
a window too narrow for that shortens the names, never a bar past 5em */
.sess-bars { display: grid; grid-template-columns: minmax(0, max-content) minmax(5em, 1fr) auto 4.2em; column-gap: 10px; row-gap: 1px; }
.sess-bars.tools { grid-template-columns: minmax(0, max-content) minmax(5em, 1fr) auto auto 2.8em; }
.sess-bars > * { grid-column: 1 / -1; }
.sess-bar { display: grid; grid-template-columns: subgrid; align-items: center; gap: 10px; height: 26px; padding: 0 6px; margin: 0 -6px; border: 0; border-radius: 6px; background: none; color: var(--fg-2); font: inherit; font-size: 12px; text-align: left; cursor: default; }
.sess-bar:hover { background: var(--pill); }
.sess-bar.on { background: var(--pill); color: var(--fg); font-weight: 550; }
.sess-bar .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -836,9 +841,8 @@ details.cx-part[open] > summary .cx-h { margin-bottom: 2px; }
.sess-shape .col span { font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sess-tools-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; }
@container (max-width: 700px) { .sess-tools-cols { grid-template-columns: minmax(0, 1fr); } }
.sess-bar.tool { grid-template-columns: minmax(0, 10em) minmax(0, 1fr) auto auto 2.8em; }
.sess-bar.tool .n { display: flex; align-items: center; gap: 7px; }
.sess-bar.tool .n span { overflow: hidden; text-overflow: ellipsis; }
.sess-bar.tool .n span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sess-bar.tool .track i { opacity: .85; }
.sess-bar.tool .s { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sess-bar.tool .p { font-size: 11px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
@@ -856,10 +860,20 @@ details.cx-part[open] > summary .cx-h { margin-bottom: 2px; }
.sess-weeks .stack { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 3px; overflow: hidden; }
.sess-weeks .stack i { min-height: 1px; }
.sess-weeks-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); }
.sess-skills { display: flex; flex-direction: column; gap: 2px; }
.sess-skill { padding: 4px 6px; margin: 0 -6px; border-radius: 6px; min-width: 0; }
.sess-skills { display: grid; grid-template-columns: minmax(0, max-content) minmax(5em, 1fr) auto; column-gap: 10px; row-gap: 2px; }
.sess-skills > * { grid-column: 1 / -1; }
.sess-skill { display: grid; grid-template-columns: subgrid; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; min-width: 0; }
.sess-skill:hover { background: var(--pill); }
.sess-skill .line { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12px; }
.sess-skill .line, .sess-skill .sub { grid-column: 1 / -1; }
.sess-skill .line { display: grid; grid-template-columns: subgrid; align-items: center; gap: 10px; font-size: 12px; }
/* before subgrid (Safari 16) each row is a grid of its own, its name as
wide as it needs and its bar at least 5em */
@supports not (grid-template-columns: subgrid) {
.sess-bar { grid-template-columns: minmax(0, max-content) minmax(5em, 1fr) auto 4.2em; }
.sess-bar.tool { grid-template-columns: minmax(0, max-content) minmax(5em, 1fr) auto auto 2.8em; }
.sess-skill { display: block; }
.sess-skill .line { grid-template-columns: minmax(0, max-content) minmax(5em, 1fr) auto; }
}
.sess-skill .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); font-weight: 550; }
.sess-skill .track { height: 6px; border-radius: 3px; background: var(--pill); overflow: hidden; }
.sess-skill:hover .track { background: var(--card); }
+1 -1
View File
@@ -9764,7 +9764,7 @@ function renderSessTools() {
const cols = el("div", "sess-tools-cols");
// the most called, each with its kind's dot, calls, sessions and share
const top = el("div", "sess-bars");
const top = el("div", "sess-bars tools");
const peak = Math.max(1, ...tu.top.map((x) => x.calls));
for (const x of tu.top) {
const r = el("div", "sess-bar tool");
+8 -1
View File
@@ -477,6 +477,13 @@ autonomy (remembered, the page left where it was), tool use (the top tools,
their kinds and weeks) and the top skills with their last use, agents and
projects.
`sessions-bar-names.test.cjs` checks the Sessions overview's bar rows
(projects, models, tools and skills: a name, a bar, figures): at 1600 wide
every long name is shown whole, each card's bars start at one place and are
at least 5em, at 420 wide the long names are shortened while no bar is under
5em and nothing runs past its card, and wide again the names are whole; in
Chromium and WebKit, English and Chinese.
`sessions-calendar-fill.test.cjs` checks that the Sessions overview's activity
calendar fills its card: 118 days (17 weeks) at 1400 wide take over 90% of
it, the weeks before the range coming in as empty cells without tooltips, the
@@ -976,7 +983,7 @@ reads shows none of it. English and Chinese, Chromium and WebKit, with
With Node.js and Playwright available:
```sh
node --test internal/gui/tests/menu-scroll.test.cjs internal/gui/tests/click-scroll.test.cjs internal/gui/tests/panel-fold.test.cjs internal/gui/tests/rollup-short.test.cjs internal/gui/tests/panel-routing.test.cjs internal/gui/tests/gateway-fold.test.cjs internal/gui/tests/routing-kind.test.cjs internal/gui/tests/balance-fix.test.cjs internal/gui/tests/cli-update.test.cjs internal/gui/tests/login-import.test.cjs internal/gui/tests/agy-launch.test.cjs internal/gui/tests/currency.test.cjs internal/gui/tests/usage-ledger.test.cjs internal/gui/tests/update-check.test.cjs internal/gui/tests/omarchy.test.cjs internal/gui/tests/brand.test.cjs internal/gui/tests/library-loading.test.cjs internal/gui/tests/provider-typed.test.cjs node --test internal/gui/tests/signin-callback.test.cjs internal/gui/tests/routing-steady.test.cjs internal/gui/tests/old-webkit.test.cjs internal/gui/tests/session-terminal.test.cjs internal/gui/tests/text-size.test.cjs internal/gui/tests/zcode-site.test.cjs internal/gui/tests/rail-tip.test.cjs internal/gui/tests/sync-update.test.cjs internal/gui/tests/plugin-signin.test.cjs internal/gui/tests/plugin-market.test.cjs internal/gui/tests/s3-sync.test.cjs internal/gui/tests/routing-wb-refused.test.cjs internal/gui/tests/routing-blocked.test.cjs internal/gui/tests/routing-zcode-blocked.test.cjs internal/gui/tests/routing-shape.test.cjs internal/gui/tests/market-have.test.cjs internal/gui/tests/sessions-today.test.cjs internal/gui/tests/routing-side-calls.test.cjs internal/gui/tests/import-all-skills.test.cjs internal/gui/tests/routing-flood.test.cjs internal/gui/tests/routing-busy.test.cjs internal/gui/tests/own-skill.test.cjs internal/gui/tests/routing-manual.test.cjs internal/gui/tests/tray-usages.test.cjs internal/gui/tests/provider-remove.test.cjs internal/gui/tests/signin-link.test.cjs internal/gui/tests/tray-inuse.test.cjs internal/gui/tests/codex-auto-reset.test.cjs internal/gui/tests/routing-auto-reset.test.cjs internal/gui/tests/claude-usage-asked.test.cjs internal/gui/tests/claude-risk.test.cjs internal/gui/tests/library-toggle-status.test.cjs internal/gui/tests/library-all.test.cjs internal/gui/tests/routing-reroute-title.test.cjs internal/gui/tests/plain-names.test.cjs internal/gui/tests/panel-effort.test.cjs internal/gui/tests/agent-models-all-hidden.test.cjs internal/gui/tests/omp-roles.test.cjs internal/gui/tests/claude-effort.test.cjs internal/gui/tests/remote-magpie.test.cjs internal/gui/tests/qoder-cn-tile.test.cjs internal/gui/tests/provider-levels-scroll.test.cjs internal/gui/tests/signin-paste-codex.test.cjs internal/gui/tests/signin-paste-key.test.cjs internal/gui/tests/usage-alert.test.cjs internal/gui/tests/quota-families.test.cjs internal/gui/tests/provider-search.test.cjs internal/gui/tests/webdav-settings-refresh.test.cjs internal/gui/tests/lan-docker.test.cjs internal/gui/tests/plugin-key-hint.test.cjs internal/gui/tests/update-hide.test.cjs internal/gui/tests/tray-logos.test.cjs internal/gui/tests/routing-proxy.test.cjs internal/gui/tests/sse-body.test.cjs internal/gui/tests/remote-group-served.test.cjs internal/gui/tests/plugin-move-overflow.test.cjs internal/gui/tests/routing-time.test.cjs internal/gui/tests/unlisted-models.test.cjs internal/gui/tests/plugin-updates.test.cjs internal/gui/tests/request-archive.test.cjs internal/gui/tests/group-member-fast.test.cjs internal/gui/tests/providers-off-fold.test.cjs internal/gui/tests/account-return.test.cjs internal/gui/tests/usage-ledger-detail.test.cjs internal/gui/tests/usage-ledger-chart.test.cjs internal/gui/tests/usage-chart-axis.test.cjs internal/gui/tests/panel-usage.test.cjs internal/gui/tests/usage-refresh.test.cjs internal/gui/tests/usage-ledger-content.test.cjs internal/gui/tests/claude-direct.test.cjs internal/gui/tests/signin-again.test.cjs internal/gui/tests/sessions-calendar-fill.test.cjs internal/gui/tests/editor-short-window.test.cjs internal/gui/tests/group-from-model-add.test.cjs internal/gui/tests/sync-other-kind.test.cjs internal/gui/tests/web-page.test.cjs internal/gui/tests/balance-parts.test.cjs internal/gui/tests/search-api.test.cjs internal/gui/tests/provider-file-error.test.cjs internal/gui/tests/sessions-manage.test.cjs internal/gui/tests/number-units.test.cjs
node --test internal/gui/tests/menu-scroll.test.cjs internal/gui/tests/click-scroll.test.cjs internal/gui/tests/panel-fold.test.cjs internal/gui/tests/rollup-short.test.cjs internal/gui/tests/panel-routing.test.cjs internal/gui/tests/gateway-fold.test.cjs internal/gui/tests/routing-kind.test.cjs internal/gui/tests/balance-fix.test.cjs internal/gui/tests/cli-update.test.cjs internal/gui/tests/login-import.test.cjs internal/gui/tests/agy-launch.test.cjs internal/gui/tests/currency.test.cjs internal/gui/tests/usage-ledger.test.cjs internal/gui/tests/update-check.test.cjs internal/gui/tests/omarchy.test.cjs internal/gui/tests/brand.test.cjs internal/gui/tests/library-loading.test.cjs internal/gui/tests/provider-typed.test.cjs node --test internal/gui/tests/signin-callback.test.cjs internal/gui/tests/routing-steady.test.cjs internal/gui/tests/old-webkit.test.cjs internal/gui/tests/session-terminal.test.cjs internal/gui/tests/text-size.test.cjs internal/gui/tests/zcode-site.test.cjs internal/gui/tests/rail-tip.test.cjs internal/gui/tests/sync-update.test.cjs internal/gui/tests/plugin-signin.test.cjs internal/gui/tests/plugin-market.test.cjs internal/gui/tests/s3-sync.test.cjs internal/gui/tests/routing-wb-refused.test.cjs internal/gui/tests/routing-blocked.test.cjs internal/gui/tests/routing-zcode-blocked.test.cjs internal/gui/tests/routing-shape.test.cjs internal/gui/tests/market-have.test.cjs internal/gui/tests/sessions-today.test.cjs internal/gui/tests/routing-side-calls.test.cjs internal/gui/tests/import-all-skills.test.cjs internal/gui/tests/routing-flood.test.cjs internal/gui/tests/routing-busy.test.cjs internal/gui/tests/own-skill.test.cjs internal/gui/tests/routing-manual.test.cjs internal/gui/tests/tray-usages.test.cjs internal/gui/tests/provider-remove.test.cjs internal/gui/tests/signin-link.test.cjs internal/gui/tests/tray-inuse.test.cjs internal/gui/tests/codex-auto-reset.test.cjs internal/gui/tests/routing-auto-reset.test.cjs internal/gui/tests/claude-usage-asked.test.cjs internal/gui/tests/claude-risk.test.cjs internal/gui/tests/library-toggle-status.test.cjs internal/gui/tests/library-all.test.cjs internal/gui/tests/routing-reroute-title.test.cjs internal/gui/tests/plain-names.test.cjs internal/gui/tests/panel-effort.test.cjs internal/gui/tests/agent-models-all-hidden.test.cjs internal/gui/tests/omp-roles.test.cjs internal/gui/tests/claude-effort.test.cjs internal/gui/tests/remote-magpie.test.cjs internal/gui/tests/qoder-cn-tile.test.cjs internal/gui/tests/provider-levels-scroll.test.cjs internal/gui/tests/signin-paste-codex.test.cjs internal/gui/tests/signin-paste-key.test.cjs internal/gui/tests/usage-alert.test.cjs internal/gui/tests/quota-families.test.cjs internal/gui/tests/provider-search.test.cjs internal/gui/tests/webdav-settings-refresh.test.cjs internal/gui/tests/lan-docker.test.cjs internal/gui/tests/plugin-key-hint.test.cjs internal/gui/tests/update-hide.test.cjs internal/gui/tests/tray-logos.test.cjs internal/gui/tests/routing-proxy.test.cjs internal/gui/tests/sse-body.test.cjs internal/gui/tests/remote-group-served.test.cjs internal/gui/tests/plugin-move-overflow.test.cjs internal/gui/tests/routing-time.test.cjs internal/gui/tests/unlisted-models.test.cjs internal/gui/tests/plugin-updates.test.cjs internal/gui/tests/request-archive.test.cjs internal/gui/tests/group-member-fast.test.cjs internal/gui/tests/providers-off-fold.test.cjs internal/gui/tests/account-return.test.cjs internal/gui/tests/usage-ledger-detail.test.cjs internal/gui/tests/usage-ledger-chart.test.cjs internal/gui/tests/usage-chart-axis.test.cjs internal/gui/tests/panel-usage.test.cjs internal/gui/tests/usage-refresh.test.cjs internal/gui/tests/usage-ledger-content.test.cjs internal/gui/tests/claude-direct.test.cjs internal/gui/tests/signin-again.test.cjs internal/gui/tests/sessions-calendar-fill.test.cjs internal/gui/tests/editor-short-window.test.cjs internal/gui/tests/group-from-model-add.test.cjs internal/gui/tests/sync-other-kind.test.cjs internal/gui/tests/web-page.test.cjs internal/gui/tests/balance-parts.test.cjs internal/gui/tests/search-api.test.cjs internal/gui/tests/provider-file-error.test.cjs internal/gui/tests/sessions-manage.test.cjs internal/gui/tests/number-units.test.cjs internal/gui/tests/sessions-bar-names.test.cjs
```
If Playwright is installed outside the repository, set `NODE_PATH` to the
@@ -0,0 +1,137 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
// The Sessions overview's bars, a name, a bar and figures a row (John on
// Discord: widening the window grew the bars and left the names cut short
// with "…"): the names were held to 9em, 10em and 11em whatever the width.
// Now a card's names take the width the longest needs and the bars what is
// left, every row's bar starting at the same place; narrow, the names are
// shortened and a bar is never under 5em.
const assert = require("node:assert/strict");
const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
const iso = (d) => [d.getFullYear(), d.getMonth() + 1, d.getDate()].map((n) => String(n).padStart(2, "0")).join("-");
const to = new Date(2026, 8, 28);
const back = (i) => { const d = new Date(to); d.setDate(d.getDate() - i); return d; };
const LONG_DIR = "/work/a-rather-long-project-folder-name";
const LONG_MODEL = "claude-sonnet-4-5-20250929-extended";
const LONG_TOOL = "mcp__slack__send_message_draft";
const LONG_SKILL = "document-skills:frontend-design";
const allDays = Array.from({ length: 20 }, (_, i) => back(19 - i)).map((d, i) => ({
date: iso(d),
usage: [
{ agent: "claude", cwd: LONG_DIR, model: LONG_MODEL, input: 30000 * (i + 1), output: 4000, cache_read: 0, cache_write: 0, cost: 1.5, priced: true },
{ agent: "codex", cwd: "/work/b", model: "gpt-5", input: 10000, output: 2000, cache_read: 0, cache_write: 0, cost: 0.4, priced: true },
],
active: [],
}));
function serve(lang) {
const state = { agents: [{ id: "claude", name: "Claude Code", path: "/test/settings.json", fields: [] }], profiles: [], settings: { lang, theme: "light" } };
return async (route) => {
const url = new URL(route.request().url());
const json = (data) => route.fulfill({ json: data });
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
if (url.pathname === "/api/state") return json(state);
if (url.pathname === "/api/plugins") return json({ plugins: [] });
if (url.pathname === "/api/sessions/progress") return json({ indexing: false });
if (url.pathname === "/api/sessions") return json({ sessions: [], dirs: ["/test/sessions"] });
if (url.pathname === "/api/sessions/stats") return json({ from: allDays[0].date, to: iso(to), days: allDays, agents: { claude: "Claude Code", codex: "Codex" } });
if (url.pathname === "/api/sessions/overview") {
return json({ count: 4, median: 1000, p90: 2000, days: allDays.map(() => 1), top: { tokens: [], cost: [], active: [] },
messages: allDays.map(() => 3), output: allDays.map(() => 0),
shape: { messages: { edges: [1], counts: [4], total: 4 }, minutes: { edges: [1], counts: [4], total: 4 }, autonomy: { edges: [0], counts: [4], total: 4 } },
tools: {
calls: 100, sessions: 4,
top: [{ name: LONG_TOOL, category: "Tool", calls: 60, sessions: 3 }, { name: "Bash", category: "Bash", calls: 40, sessions: 4 }],
categories: [{ name: "Tool", calls: 60, sessions: 3 }, { name: "Bash", calls: 40, sessions: 4 }],
weeks: [],
},
skills: {
calls: 30, count: 2,
top: [{ name: LONG_SKILL, calls: 20, sessions: 3, agents: { claude: 20 }, projects: [] }, { name: "pdf", calls: 10, sessions: 1, agents: { claude: 10 }, projects: [] }],
} });
}
if (url.pathname === "/api/groups") return json({ groups: [] });
if (url.pathname === "/api/usage/quotas") return json([]);
if (url.pathname.startsWith("/api/")) return json({});
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
const body = await fs.readFile(file).catch(() => null);
await (body ? route.fulfill({ body, contentType }) : route.fulfill({ status: 404, body: "" }));
};
}
// each bar row of the four cards: its name's full and shown widths, its bar's
const rows = (page) => page.evaluate(() => {
const out = [];
const pick = (sel, name, track) => document.querySelectorAll(sel).forEach((r) => {
const n = r.querySelector(name), b = r.querySelector(track).getBoundingClientRect();
out.push({ sel, text: n.textContent, full: n.scrollWidth, shown: n.clientWidth, bar: b.width, left: b.left, card: r.closest(".sess-card").id });
});
pick("#sessProjects .sess-bar", ".n", ".track");
pick("#sessModels .sess-bar", ".n", ".track");
pick("#sessTools .sess-bar.tool", ".n span", ".track");
pick("#sessSkills .sess-skill .line", ".n", ".track");
return out;
});
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh"]) {
test(`${engine} ${lang}: the sessions bars' names take the width they need`, async (t) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
const context = await browser.newContext({ viewport: { width: 1600, height: 900 }, reducedMotion: "reduce", timezoneId: "Asia/Shanghai" });
const page = await context.newPage();
page.setDefaultTimeout(5000);
const errors = [];
page.on("pageerror", (e) => errors.push(e.message));
await page.route("**/*", serve(lang));
await page.addInitScript(() => { localStorage.setItem("magpie.usageTab", "sessions"); localStorage.setItem("magpie.sessRange", "all"); });
t.after(async () => {
if (process.env.ARTIFACT_DIR) {
await fs.mkdir(process.env.ARTIFACT_DIR, { recursive: true });
await page.screenshot({ path: path.join(process.env.ARTIFACT_DIR, `${engine}-${lang}-sess-bars.png`), fullPage: true });
}
await browser.close();
});
await page.goto("http://magpie.test/?view=usage");
await page.locator("#sessGrid:not([hidden])").waitFor();
await page.waitForFunction(() => document.querySelector("#sessSkills .sess-skill") && document.querySelector("#sessTools .sess-bar.tool") && document.querySelectorAll("#sessModels .sess-bar").length === 2);
await t.test("wide: every name whole, the bars still there and lined up", async () => {
const rs = await rows(page);
assert.equal(rs.length, 8, JSON.stringify(rs));
for (const r of rs) {
assert.ok(r.full <= r.shown + 0.5, `${r.sel} "${r.text}" cut short: ${r.full} > ${r.shown}`);
assert.ok(r.bar >= 60, `${r.sel} "${r.text}" bar ${r.bar}`);
}
for (const card of new Set(rs.map((r) => r.card))) {
const lefts = rs.filter((r) => r.card === card).map((r) => Math.round(r.left));
assert.equal(new Set(lefts).size, 1, `${card} bars start at ${lefts}`);
}
assert.ok(rs.some((r) => r.text === LONG_DIR.split("/").pop()) && rs.some((r) => r.text === LONG_MODEL));
});
await t.test("narrow: the long names shortened, no bar under 5em", async () => {
await page.setViewportSize({ width: 420, height: 900 });
await page.waitForTimeout(100);
const rs = await rows(page);
for (const r of rs) assert.ok(r.bar >= 59, `${r.sel} "${r.text}" bar ${r.bar}`);
assert.ok(rs.some((r) => r.full > r.shown), "a long name should be shortened at 420 wide");
// nothing past its card
const over = await page.evaluate(() => [...document.querySelectorAll("#sessGrid .sess-card")].filter((c) => c.scrollWidth > c.clientWidth + 1).map((c) => c.id));
assert.deepEqual(over, []);
});
await t.test("wide again", async () => {
await page.setViewportSize({ width: 1600, height: 900 });
await page.waitForTimeout(100);
for (const r of await rows(page)) assert.ok(r.full <= r.shown + 0.5, `${r.sel} "${r.text}" cut short`);
});
assert.deepEqual(errors, []);
});
}
}