v0.36.2
This commit is contained in:
1 parent
6d7f152a0b
commit
064772765b
24 files changed
+418
-67
No files matched your search
@@ -32,13 +32,13 @@ function t(key) { return translations[key] || key; }
|
||||
(() => {
|
||||
const fail = message => { document.getElementById("browser-icon-test").textContent = `FAIL: ${message}`; throw new Error(message); };
|
||||
const result = document.getElementById("browser-icon-test");
|
||||
const eligible = [...document.querySelectorAll("button, a.primary, a.outline, a.quiet")].filter(node => !node.matches(".chart-style-choice"));
|
||||
const eligible = [...document.querySelectorAll("button, a.primary, a.outline, a.quiet")].filter(node => window.rustProxyIcons.iconFor(node) !== null);
|
||||
if (document.querySelectorAll("svg.ui-icon").length !== 0) fail("icons must be absent before enabling the preference");
|
||||
window.rustProxyIcons.setEnabled(true);
|
||||
const decorated = eligible.filter(node => node.querySelector(":scope > svg.ui-icon"));
|
||||
if (decorated.length !== eligible.length) fail(`expected ${eligible.length} decorated controls, got ${decorated.length}`);
|
||||
if ([...document.querySelectorAll("svg.ui-icon")].some(icon => icon.getAttribute("aria-hidden") !== "true")) fail("SVG icons must be aria-hidden");
|
||||
const expectedPanels = { overview: "grid", vhosts: "network", "web-server": "globe", "docker-vhosts": "box", redirects: "route", notfound: "fileX", streams: "network", "acl-profiles": "shield", tls: "certificate", traffic: "activity", cache: "database", transform: "wand", settings: "settings" };
|
||||
const expectedPanels = { overview: "grid", vhosts: "network", "web-server": "globe", "docker-vhosts": "box", redirects: "route", notfound: "fileX", streams: "transfer", "acl-profiles": "shield", tls: "certificate", traffic: "activity", cache: "database", transform: "wand", settings: "settings" };
|
||||
for (const [panel, icon] of Object.entries(expectedPanels)) {
|
||||
const button = document.querySelector(`[data-panel="${panel}"]`);
|
||||
if (button?.querySelector(":scope > svg.ui-icon")?.dataset.uiIcon !== icon) fail(`panel ${panel} must use ${icon}`);
|
||||
|
||||
@@ -47,4 +47,28 @@ for (const icon of ["plus", "save", "check", "trash", "edit", "refresh", "settin
|
||||
assert.ok(new RegExp(`\\b${icon}:`).test(icons), `missing semantic SVG icon definition: ${icon}`);
|
||||
}
|
||||
|
||||
// 0.36.2 semantic review: verbs/explicit ids must win over colliding keywords.
|
||||
const explicitIcons = { "overview-layout-unlock": "unlock", "overview-inline-save": "lock", "overview-layout-open": "layers", "docker-settings-open": "settings", "login-submit": "login", "revoke-sessions": "logout", "about-open": "info" };
|
||||
for (const [id, icon] of Object.entries(explicitIcons)) assert.match(icons, new RegExp(`"${id}": "${icon}"`), `${id} must use ${icon}`);
|
||||
assert.match(icons, /\(\^\|\[\^p\]\)reset/, "preset buttons must not match the reset rule");
|
||||
assert.match(icons, /UI_GLYPH_LABEL/);
|
||||
assert.match(icons, /raw === key/, "English labels equal to their key must still count as translated");
|
||||
for (const icon of ["unlock", "layers", "expand", "collapse", "ban", "eraser", "hash", "info", "plug", "transfer", "mapPin", "compare"]) {
|
||||
assert.ok(new RegExp(`\\b${icon}:`).test(icons), `missing semantic SVG icon definition: ${icon}`);
|
||||
}
|
||||
|
||||
const logo = read("src/admin/web/app/logo-animation.js");
|
||||
const router = read("src/admin/router.rs");
|
||||
const shellCss = read("src/admin/web/css/20-shell.css");
|
||||
assert.match(html, /id="ui-logo-animation"[^>]*type="checkbox"/);
|
||||
assert.match(router, /web\/app\/logo-animation\.js/);
|
||||
assert.match(preferences, /logo_animation:\s*false/);
|
||||
assert.match(preferences, /applyAdminLogoAnimation\(value\.logo_animation\)/);
|
||||
assert.match(preferences, /saveAppearancePreference\(\{ logo_animation: next \}/);
|
||||
assert.match(logo, /prefers-reduced-motion: reduce/);
|
||||
assert.match(logo, /document\.hidden/);
|
||||
assert.match(shellCss, /prefers-reduced-motion: reduce[\s\S]*data-logo-effect/);
|
||||
assert.equal(openapi.components.schemas.AdminPreferences.properties.logo_animation.default, false);
|
||||
assert.ok(pl.translations.logoAnimation && pl.translations.logoAnimationHelp);
|
||||
|
||||
console.log("Panel SVG icon preference contract: OK");
|
||||
@@ -51,5 +51,5 @@ const events = openapi.paths["/api/events"].get;
|
||||
const logsFlag = (events.parameters || []).find(parameter => parameter.name === "logs");
|
||||
assert.equal(logsFlag?.schema?.type, "boolean");
|
||||
assert.equal(logsFlag?.schema?.default, true);
|
||||
assert.equal(openapi.info.version, "0.36.1");
|
||||
assert.equal(openapi.info.version, "0.36.2");
|
||||
console.log("Panel refresh/API contract checks: OK");
|
||||
Reference in new issue
Block a user