Refine Dock with overlay rail, account menu, motion and teal themes

This commit is contained in:
SantaSpeen committed 2026-11-27 19:41:45 +03:00
1 parent ae037908ab
commit 53199205e3
38 files changed
+740 -61

No files matched your search

+7 -1
View File
@@ -266,7 +266,13 @@ try {
await page.setViewportSize({ width: 390, height: 844 });
for (const c of concepts) {
await page.goto(url(c.id));
await page.locator("[data-action=mobile-menu]").click();
await page
.locator(
c.id === "dock"
? "[data-action=dock-toggle]"
: "[data-action=mobile-menu]",
)
.click();
await page.locator(".nav-links [data-page=users]").click();
await page.locator("#user-search").waitFor();
for (const density of ["compact", "relaxed"]) {
+148
View File
@@ -0,0 +1,148 @@
import { chromium } from "playwright";
import assert from "node:assert/strict";
import { mkdir, writeFile } from "node:fs/promises";
const base = process.env.BASE_URL || "http://127.0.0.1:4173";
const browser = await chromium.launch({
executablePath:
process.env.PLAYWRIGHT_EXECUTABLE_PATH ||
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
headless: true,
});
let passed = 0;
const errors = [];
await mkdir("references/dock-revision", { recursive: true });
try {
const p = await browser.newPage();
p.on("pageerror", (e) => errors.push(e.message));
for (const theme of ["light", "dark"])
for (const [device, width, height] of [
["desktop", 1440, 900],
["tablet", 768, 1024],
["mobile", 390, 844],
]) {
await p.setViewportSize({ width, height });
await p.goto(
`${base}/playground/frame.html?concept=dock&density=compact&theme=${theme}`,
);
await p.locator("h1").waitFor();
await p.waitForTimeout(400);
assert.ok(
await p
.locator(".navigation")
.evaluate((el) => el.getBoundingClientRect().width <= 68),
);
assert.equal(
await p
.locator(".nav-links button>span")
.first()
.evaluate((el) => getComputedStyle(el).opacity),
"0",
);
const before = await p.locator(".main-column").boundingBox();
await p.screenshot({
path: `references/dock-revision/${theme}-${device}-collapsed.png`,
});
await p.locator(".dock-toggle").click();
await p.waitForTimeout(300);
const after = await p.locator(".main-column").boundingBox();
assert.equal(before.x, after.x);
assert.equal(before.width, after.width);
assert.equal(
await p.locator(".main-column").evaluate((el) => el.inert),
true,
);
assert.equal(
await p
.locator(".dock-scrim")
.evaluate((el) => getComputedStyle(el).opacity),
"1",
);
assert.equal(
await p
.locator(".nav-links button>span")
.first()
.evaluate((el) => getComputedStyle(el).opacity),
"1",
);
await p.screenshot({
path: `references/dock-revision/${theme}-${device}-expanded.png`,
});
await p.locator(".dock-account").click();
await p.locator("#account-menu").waitFor({ state: "visible" });
await p.waitForTimeout(220);
await p.screenshot({
path: `references/dock-revision/${theme}-${device}-account.png`,
});
await p.locator("#account-menu [data-action=switch-account]").click();
await p.locator("#dialog").waitFor({ state: "visible" });
await p.locator('[data-account="Mikhail Orlov"]').click();
assert.equal(
await p.locator(".account-identity b").innerText(),
"Mikhail Orlov",
);
await p.locator(".dock-toggle").click();
await p.keyboard.press("Escape");
assert.equal(
await p.locator(".main-column").evaluate((el) => el.inert),
false,
);
await p.locator(".dock-toggle").click();
await p.waitForTimeout(300);
await p.mouse.click(width - 12, Math.floor(height / 2));
assert.equal(
await p.locator(".dock-toggle").getAttribute("aria-expanded"),
"false",
);
assert.ok(
await p.evaluate(
() => document.documentElement.scrollWidth <= innerWidth + 1,
),
);
passed++;
}
await p.locator(".dock-toggle").click();
await p.locator(".dock-account").focus();
await p.keyboard.press("Enter");
assert.equal(
await p.evaluate(() => document.activeElement.closest("[popover]")?.id),
"account-menu",
);
await p.keyboard.press("Escape");
assert.equal(
await p.locator(".dock-toggle").getAttribute("aria-expanded"),
"true",
);
await p.keyboard.press("Escape");
assert.equal(
await p.locator(".dock-toggle").getAttribute("aria-expanded"),
"false",
);
passed++;
await p.emulateMedia({ reducedMotion: "reduce" });
await p.reload();
assert.equal(
await p
.locator(".panel")
.first()
.evaluate((el) => getComputedStyle(el).animationName),
"none",
);
passed++;
assert.deepEqual(errors, []);
await writeFile(
"references/dock-revision/qa.json",
JSON.stringify(
{
passed,
errors,
checks:
"6 theme/viewport scenarios: overlay geometry, inert background, scrim, icons/labels, account switch, Escape/outside close; reduced motion",
},
null,
2,
),
);
console.log("Dock revision:", passed, "passed");
} finally {
await browser.close();
}