gui: Manage agents' names sit beside their icons, not at the row's far end

The owner's screenshot (zh, a wide window): each row's name was pushed
to the right edge, next to 未隐藏, far from its icon. A row is a <label>,
so .editor label, a form field's label rule (text-align: right, 12px,
padding-top 5px), reached it and outranked .ag-manage-row; under 560px
another rule set labels left, which is why the narrow tests never saw it.
The row's rule is now .modal .editor label.ag-manage-row, left-aligned,
13px in the text colour, with its own padding back.

Run:
- agent-bulk-visibility.test.cjs, which now measures each name's text
  against its icon at 1240 and 560 wide in every language: 10/10
  (Chromium, WebKit; en, zh, zh-TW, ja, de). With the old app.css
  0/10, "name beside its icon at 1240: 424,410,435,427". zh screenshots
  at both widths looked at.
- agent-visibility-saving 12/12, panel-fold 6/6 (the other files that
  open this sheet). The selector matches only .ag-manage-row, which
  app.js makes only in this sheet, so no other page can reach it.
Not tried: the real app window.
This commit is contained in:
yetone
2026-10-19 16:45:35 +08:00
parent 65f5f0153d
commit ab7ec8c657
2 changed files with 18 additions and 1 deletions
+2 -1
View File
@@ -4129,7 +4129,8 @@ input[type="checkbox"]:disabled { opacity: .45; }
.ag-manager .ag-manage-search { width: 100%; box-sizing: border-box; }
.ag-manage-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.ag-manage-count, .ag-manage-state { color: var(--fg-2); font-size: 12px; }
.ag-manage-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
/* a row is a <label>: .editor label (a form field's, right-aligned) is not this */
.modal .editor label.ag-manage-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; text-align: left; font-size: 13px; color: var(--fg); cursor: pointer; }
.ag-manage-row > input { flex: none; }
.ag-manage-row > .ic { width: 22px; height: 22px; flex: none; }
.ag-manage-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@@ -75,6 +75,22 @@ for (const engine of process.env.BROWSER ? [process.env.BROWSER] : ['chromium',
const dialog = page.getByRole('dialog'), search = dialog.locator('input[type=search]');
const button = (name) => dialog.getByRole('button', { name, exact: true });
assert.equal(await dialog.getByRole('checkbox').count(), 4, 'hidden and folded agents are manageable');
// a name's text sits beside its icon, not at the row's far end (the
// owner's screenshot: .editor label's right alignment reached the
// rows of a wide window), wide and narrow
for (const width of [1240, 560]) {
await page.setViewportSize({width, height:760});
await page.waitForFunction((w) => window.innerWidth === w, width);
const gaps = await dialog.locator('.ag-manage-row').evaluateAll((rows) => rows.map((r) => {
const range = document.createRange();
range.selectNodeContents(r.querySelector('.ag-manage-name'));
return Math.round(range.getBoundingClientRect().left - r.querySelector('.ic').getBoundingClientRect().right);
}));
assert(gaps.every((g) => g >= 4 && g <= 14), `name beside its icon at ${width}: ${gaps}`);
if (process.env.ROW_SHOT && lang === 'zh') await dialog.screenshot({path:`${process.env.ROW_SHOT}-${engine}-${width}.png`});
}
await page.setViewportSize({width:lang === 'en' ? 1240 : 560, height:760});
await page.waitForFunction((w) => window.innerWidth === w, lang === 'en' ? 1240 : 560);
assert(await button(hide).isDisabled());
await search.fill('not-an-agent');
assert.equal(await dialog.getByRole('checkbox').count(), 0);