Add configurable sidebar contrast settings
This commit is contained in:
@@ -59,15 +59,21 @@ test("left controls open in a responsive sidebar drawer", async ({ page }) => {
|
||||
|
||||
test("theme toggle switches and persists dark mode", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.locator("html")).not.toHaveClass(/dark/);
|
||||
await page.evaluate(() => localStorage.clear());
|
||||
await page.reload();
|
||||
await expect(page.locator("html")).not.toHaveClass(/(?:^| )dark(?: |$)/);
|
||||
const lightPanelBackground = await page.locator("#sidebarDrawer").evaluate((element) => getComputedStyle(element).backgroundColor);
|
||||
|
||||
await page.locator("#themeToggle").click();
|
||||
await expect(page.locator("html")).toHaveClass(/dark/);
|
||||
await expect(page.locator("html")).toHaveClass(/(?:^| )dark(?: |$)/);
|
||||
await expect(page.locator("#themeToggle")).toHaveText("Light theme");
|
||||
const darkPanelBackground = await page.locator("#sidebarDrawer").evaluate((element) => getComputedStyle(element).backgroundColor);
|
||||
expect(darkPanelBackground).not.toBe(lightPanelBackground);
|
||||
|
||||
await page.locator("#settingsButton").click();
|
||||
await page.locator("#darkContrastSelect").selectOption("high");
|
||||
await expect(page.locator("html")).toHaveClass(/contrast-dark-high/);
|
||||
|
||||
await page.reload();
|
||||
await expect(page.locator("html")).toHaveClass(/dark/);
|
||||
await expect(page.locator("html")).toHaveClass(/(?:^| )dark(?: |$)/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user