mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 08:15:41 -08:00
Stack User Preferences' card width choices two to a row when the dialog is narrow
AI Assisted
This commit is contained in:
1 parent
8b5932c351
commit
31edc2d5c9
2 files changed
+50
No files matched your search
@@ -897,6 +897,48 @@ test("below 720 px the side list is a horizontal strip with no hints", async (t)
|
||||
await s.page.waitForFunction(() => document.getElementById("prefs-tabs").getAttribute("aria-orientation") === "vertical");
|
||||
});
|
||||
|
||||
// Every choice box in a looks row whose label overflows it, or that runs into the next box on its line.
|
||||
async function crampedChoices(s) {
|
||||
return s.page.evaluate(() => {
|
||||
const bad = [];
|
||||
for (const row of document.querySelectorAll("#prefs-panel-appearance .looks-row")) {
|
||||
const boxes = [...row.querySelectorAll(":scope > label")];
|
||||
boxes.forEach((box, i) => {
|
||||
const name = box.textContent.trim();
|
||||
if (box.scrollWidth > box.clientWidth + 1) bad.push(`${name}: its label overflows the box`);
|
||||
const next = boxes[i + 1];
|
||||
if (!next) return;
|
||||
const a = box.getBoundingClientRect();
|
||||
const b = next.getBoundingClientRect();
|
||||
if (Math.abs(a.top - b.top) < 2 && a.right > b.left + 1) bad.push(`${name}: runs into ${next.textContent.trim()}`);
|
||||
});
|
||||
}
|
||||
return bad;
|
||||
});
|
||||
}
|
||||
|
||||
test("with the Narrow card width in a wide window, no Appearance choice overflows or overlaps its neighbor", async (t) => {
|
||||
noSavedLooks(t);
|
||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||
// Wide enough that no window-width rule applies: only the dialog is narrow.
|
||||
await s.page.setViewportSize({ width: 1400, height: 900 });
|
||||
await s.page.click("#btn-looks");
|
||||
await s.page.locator("#looks-modal[open]").waitFor();
|
||||
await s.page.locator('input[name="looks-width"][value="narrow"]').check();
|
||||
await s.page.waitForFunction(() => document.documentElement.getAttribute("data-width") === "narrow");
|
||||
assert.deepEqual(await crampedChoices(s), []);
|
||||
// The other widths stay clean too.
|
||||
for (const width of ["comfortable", "wide", "ultrawide"]) {
|
||||
await s.page.locator(`input[name="looks-width"][value="${width}"]`).check();
|
||||
// The default width leaves no attribute on the page.
|
||||
await s.page.waitForFunction((w) => (document.documentElement.getAttribute("data-width") ?? "comfortable") === w, width);
|
||||
assert.deepEqual(await crampedChoices(s), [], width);
|
||||
}
|
||||
// A small window still stacks the choices in one column, as before.
|
||||
await s.page.setViewportSize({ width: 600, height: 800 });
|
||||
await s.page.waitForFunction(() => getComputedStyle(document.querySelector("#prefs-panel-appearance .looks-row.four")).gridTemplateColumns.split(" ").length === 1);
|
||||
});
|
||||
|
||||
test("Set your role on the dashboard opens on Appearance with agents and models loaded", async (t) => {
|
||||
fs.mkdirSync(HOME, { recursive: true });
|
||||
fs.writeFileSync(LOOKS_FILE, JSON.stringify({ looks: { welcomeSeen: true, skillLaunched: true } }));
|
||||
|
||||
Reference in new issue
Block a user