Make menus and hover fills translucent over a background image
With a background image, menus use the surface transparency of Appearance (82% by default) instead of at least 92%, and they keep the blur. Hovered rows and controls in the work area, hovered menu rows, and the workspace button use the new --rs-hover-bg token. With an image, it is a 6% veil of the strong text color. The image stays visible, and the hover shows over light and dark image areas. Without an image, nothing changes. Silver Serpent dim text is now #c2c6cc. It keeps 4.5:1 contrast on a hovered row over a white image. UI-061 replaces the image rule of UI-043. Card 05b9bfa1.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// The native Background feature (src/lib/features/background/): a folder slideshow with mocked host commands, a fade,
|
||||
// reduced motion, Next and Pause from the command palette, the targets, menus at 92% with an image and opaque with
|
||||
// Background off, a browser window, the settings section in both themes and at 360 pixels, the image source,
|
||||
// and the first-start migration from seeded plugin settings and from a seeded image.
|
||||
// reduced motion, Next and Pause from the command palette, the targets, translucent menus and hover fills with an image,
|
||||
// opaque menus and hover fills with Background off, a browser window, the settings section in both themes and at
|
||||
// 360 pixels, the image source, and the first-start migration from seeded plugin settings and from a seeded image.
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
@@ -17,7 +17,7 @@ const PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwM
|
||||
function folderCommands(test) {
|
||||
const snapshot = { profiles: [{ id: "user", name: "User" }], tabs: [], bookmarks: [], settings: { search: "duckduckgo", adblock: true, linkDestination: "internal", personalRules: "", homepage: "", filterLists: [] } };
|
||||
return {
|
||||
...test.workspace({ root: "C:\\background-feature", files: { "note.md": "# Note\n\nText." } }),
|
||||
...test.workspace({ root: "C:\\background-feature", files: { "note.md": "# Note\n\nText.", "other.md": "# Other" } }),
|
||||
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
|
||||
"plugin:window|is_maximized": () => false,
|
||||
spelling_menu_install: () => null,
|
||||
@@ -57,6 +57,13 @@ async function command(page, title) {
|
||||
await palette.getByRole("button").filter({ hasText: title }).first().waitFor();
|
||||
await page.keyboard.press("Enter");
|
||||
}
|
||||
// The open file shows the selection tint, so the hover check uses the other file.
|
||||
async function hoverBackground(page) {
|
||||
const row = page.locator('[data-tree-rel="other.md"]');
|
||||
await row.hover();
|
||||
return row.evaluate(node => getComputedStyle(node).backgroundColor);
|
||||
}
|
||||
|
||||
async function menuBackground(page) {
|
||||
await page.locator('[data-tree-rel="note.md"]').click({ button: "right" });
|
||||
const menu = page.getByRole("menu", { name: "File actions", exact: true });
|
||||
@@ -111,14 +118,20 @@ await runSmoke("features/background", async ({ browser }) => {
|
||||
assert.equal(await main.locator(".workarea-background").evaluate(node => node.getAnimations({ subtree: true }).length), 0, "Reduced motion has no fade");
|
||||
await main.emulateMedia({ reducedMotion: "no-preference" });
|
||||
|
||||
// With an image, menus are at least 92% opaque and blur it (UI-043).
|
||||
assert.match(await menuBackground(main), /0\.92/);
|
||||
// With an image, menus use the surface transparency (82% by default) and blur it. Hover fills and the workspace button
|
||||
// are a thin veil, so the image stays visible (UI-061).
|
||||
assert.match(await menuBackground(main), /0\.82/);
|
||||
const translucent = /(\/ 0\.06\)|, 0\.06\))$/;
|
||||
assert.match(await hoverBackground(main), translucent, "A hovered row keeps the image visible");
|
||||
assert.match(await main.locator(".workspace-button").evaluate(node => getComputedStyle(node).backgroundColor), translucent, "The workspace button keeps the image visible");
|
||||
await main.screenshot({ path: path.join(output, "hover-over-image.png") });
|
||||
|
||||
// Targets: only the boards removes the workspace frame. The frame of all boards stays for Project Management.
|
||||
await main.evaluate(() => window.__TEST__.writeSettings("background", { ...window.__TEST__.settings("background"), targets: ["pm-all"] }));
|
||||
await main.waitForFunction(() => document.body.style.getPropertyValue("--rs-background-image") === "");
|
||||
assert.equal(await main.evaluate(async () => !!(await import("/src/lib/plugins/backgrounds.ts")).backgroundHub.get("pm-all")), true);
|
||||
assert.match(await menuBackground(main), /^rgb\(/, "Without a workspace image, menus are opaque");
|
||||
assert.match(await hoverBackground(main), /^rgb\(/, "Without a workspace image, hover fills are opaque");
|
||||
await main.evaluate(() => window.__TEST__.writeSettings("background", { ...window.__TEST__.settings("background"), targets: ["app"] }));
|
||||
await waitForChange(main, "");
|
||||
|
||||
|
||||
@@ -91,10 +91,13 @@ await runSmoke("menus/consistency", async ({ page }) => {
|
||||
assert.ok(compactHeight < previousHeight * .85, 'The same actions use at least 15% less vertical space');
|
||||
console.log(JSON.stringify({ theme, compactHeight, previousHeight }));
|
||||
await page.screenshot({ path: path.join(output, `menu-spacing-after-${theme}.png`) });
|
||||
assert.ok(reference.panel[2].includes('/ 0.92') || /rgba\(.+, 0\.92\)/.test(reference.panel[2]), "With a background image, menus are at least 92% opaque");
|
||||
// With a background image, menus use the surface transparency (82% by default), and the hovered row is a thin veil (UI-061).
|
||||
assert.ok(reference.panel[2].includes('/ 0.82') || /rgba\(.+, 0\.82\)/.test(reference.panel[2]), "With a background image, menus use the surface transparency");
|
||||
assert.match(reference.panel[6], /blur\(18px\)/, "With a background image, menus blur it");
|
||||
assert.ok(reference.inset >= 5, "Rows need an inset from the panel border");
|
||||
assert.equal(await item("Pin").locator("svg.action-icon").count(), 1);
|
||||
await item("Pin").hover();
|
||||
assert.match(await item("Pin").evaluate(node => getComputedStyle(node).backgroundColor), /(\/ 0\.06\)|, 0\.06\))$/, "With a background image, the hovered row is a thin veil");
|
||||
const offsets = await file.locator(":scope > button").evaluateAll(nodes => nodes.map(node => Math.round(node.querySelector(".action-label").getBoundingClientRect().left - node.getBoundingClientRect().left)));
|
||||
assert.equal(new Set(offsets).size, 1, "All file labels align");
|
||||
await page.screenshot({ path: path.join(output, `menu-file-${theme}.png`) });
|
||||
|
||||
Reference in New Issue
Block a user