A bigger face, and the theme where the settings are
The picture fills the account button now — twenty pixels of a face is a smudge — and light or dark moved out of the sidebar corner into Account → Profile, next to the typeface and how a chapter opens, which is the kind of thing it is. Moving it made it worth keeping: it was pure screen state, so every reload landed on dark whatever had been chosen. It is a setting on the account now, like the typeface, with a copy in the browser so the page does not start in one theme and turn to the other once the account arrives. The check I first wrote for the sidebar losing its switch could not fail. It counts the buttons in that corner instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ead51b9fa0
commit
2ea448f091
8 files changed
+168
-17
No files matched your search
@@ -362,6 +362,44 @@ try {
|
||||
"and survives a reload"
|
||||
);
|
||||
|
||||
/* ── light or dark is a setting, and it belongs to the account ──
|
||||
* It used to be a sun in the corner of the sidebar: reached for by accident,
|
||||
* forgotten by the next device, and gone on every reload. */
|
||||
const shade = () =>
|
||||
p.evaluate(() => getComputedStyle(document.querySelector("#root > div") || document.body).backgroundColor);
|
||||
const wasDark = await shade();
|
||||
|
||||
await p.getByTitle("Account").click();
|
||||
await p.waitForTimeout(900);
|
||||
check(
|
||||
(await p.locator("[data-theme-option]").count()) === 2,
|
||||
"the account panel offers light and dark"
|
||||
);
|
||||
await p.locator('[data-theme-option="light"]').click();
|
||||
await p.waitForTimeout(1500);
|
||||
await p.keyboard.press("Escape");
|
||||
await p.waitForTimeout(900);
|
||||
check((await shade()) !== wasDark, "choosing one repaints the app", `${wasDark} → ${await shade()}`);
|
||||
|
||||
const themed = await api(p, "GET", "/auth/me");
|
||||
check(
|
||||
themed.body?.preferences?.theme === "light",
|
||||
"and it is stored on the account, not in this browser",
|
||||
JSON.stringify(themed.body?.preferences)
|
||||
);
|
||||
|
||||
await p.reload({ waitUntil: "networkidle" });
|
||||
await p.waitForTimeout(3000);
|
||||
check((await shade()) !== wasDark, "and it is still there after a reload", await shade());
|
||||
|
||||
/* The sun in the sidebar is gone with it — two switches for one setting is one
|
||||
too many, and that corner is for places to go. Counted where it stood: the
|
||||
account button's own row, which used to hold two. */
|
||||
const cornerButtons = await p
|
||||
.locator('[title="Account"]')
|
||||
.evaluate((el) => el.parentElement.querySelectorAll("button").length);
|
||||
check(cornerButtons === 1, "and the sidebar corner holds nothing but the account", `${cornerButtons} buttons`);
|
||||
|
||||
} catch (e) {
|
||||
check(false, "suite ran to the end", e.message);
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user