feat(webui): support custom background images (#6674)

This commit is contained in:
chengyongru authored and GitHub committed 2026-11-16 22:08:55 +08:00
1 parent 92d23d2d2b
commit e91906bc3a
29 files changed
+1259 -3

No files matched your search

+24
View File
@@ -11,6 +11,30 @@ test("appearance puts interface settings before activity display", async ({ page
]);
});
test("reading preview and theme cards let a custom background through", async ({ page }) => {
await page.emulateMedia({ colorScheme: "light" });
await page.goto("/browser/fixture.html?case=appearance");
const card = page.locator(".appearance-reading-card");
const preview = page.locator(".appearance-reading-preview");
const theme = page.locator(".appearance-theme-card").first();
const canvas = page.locator("[data-appearance-fixture]");
await canvas.evaluate(element => element.setAttribute("data-theme-surface", ""));
await expect(canvas).not.toHaveCSS("background-color", "rgba(0, 0, 0, 0)");
await page.evaluate(() => { document.documentElement.dataset.customBackground = ""; });
await expect(canvas).toHaveCSS("background-color", "rgba(0, 0, 0, 0)");
for (const surface of [card, preview, theme]) {
expect(await surface.evaluate(node => getComputedStyle(node).backgroundColor)).toMatch(/^rgba\(/);
}
await page.getByRole("radio", { name: "Dark", exact: true }).click();
await expect(page.locator("html")).toHaveClass(/dark/);
for (const surface of [card, preview, theme]) {
expect(await surface.evaluate(node => getComputedStyle(node).backgroundColor)).toMatch(/^rgba\(/);
}
await page.evaluate(() => { delete document.documentElement.dataset.customBackground; });
await expect(canvas).not.toHaveCSS("background-color", "rgba(0, 0, 0, 0)");
expect(await card.evaluate(node => getComputedStyle(node).backgroundColor)).toMatch(/^rgb\(/);
});
test("system theme stays live, explicit choices persist, and tabs agree", async ({ page, context }) => {
await page.emulateMedia({ colorScheme: "light" });
await page.goto("/browser/fixture.html?case=appearance");