157 lines
8.8 KiB
JavaScript
157 lines
8.8 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
describe("platform web shared theme CSS", () => {
|
|
it("keeps production lifecycle and alert controls bounded at narrow width", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const narrow = themeCss.slice(themeCss.indexOf("@media (max-width: 640px)", themeCss.indexOf(".production-governance-panel")));
|
|
|
|
expect(narrow).toContain(".plugin-lifecycle-controls");
|
|
expect(narrow).toContain("grid-template-columns: minmax(0, 1fr)");
|
|
expect(narrow).toContain(".production-alert-actions button");
|
|
expect(themeCss).toContain("overflow-wrap: anywhere");
|
|
});
|
|
|
|
it("suppresses nested state frames inside shared framed surfaces", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const nestedStateReset = themeCss.slice(themeCss.indexOf("A state view inside an already framed surface"));
|
|
|
|
expect(nestedStateReset).toContain(".state-view::after");
|
|
expect(nestedStateReset).toContain("content: none");
|
|
expect(nestedStateReset).toContain("background: transparent");
|
|
});
|
|
|
|
it("keeps server card runtime actions as compact overlay menus", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const popoverRule = themeCss.slice(themeCss.indexOf(".runtime-action-popover"), themeCss.indexOf("/* ---- catalog / detail lists ---- */"));
|
|
|
|
expect(popoverRule).toContain("position: fixed");
|
|
expect(popoverRule).toContain("z-index: 45");
|
|
expect(popoverRule).toContain(".runtime-action-grid");
|
|
expect(popoverRule).toContain("grid-template-columns: repeat(2, minmax(0, 1fr))");
|
|
});
|
|
|
|
it("keeps server card stat tiles readable over busy backgrounds", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const statRule = themeCss.slice(themeCss.indexOf(".server-card-stat {"), themeCss.indexOf(".server-card-meters"));
|
|
|
|
expect(statRule).toContain("border: 1px solid");
|
|
expect(statRule).toContain("--surface-solid");
|
|
expect(statRule).toContain("font-weight: 850");
|
|
expect(themeCss).toContain(':root[data-custom-background="true"] .server-card-stat');
|
|
});
|
|
|
|
it("keeps magical custom-background signal rows readable without the jelly wash", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const signalRule = themeCss.slice(
|
|
themeCss.indexOf(':root[data-custom-background="true"][data-theme-palette="magical-girl"] .signal-item'),
|
|
themeCss.indexOf(':root[data-custom-background="true"][data-theme-palette="magical-girl"] .signal-item strong')
|
|
);
|
|
|
|
expect(signalRule).toContain("rgba(58, 44, 56, 0.72)");
|
|
expect(signalRule).toContain("backdrop-filter: blur(12px) saturate(0.92)");
|
|
expect(signalRule).not.toContain("var(--jelly-highlight), var(--glass-wash), var(--surface-solid)");
|
|
});
|
|
|
|
it("keeps shared controls off the heavy jelly and corner-sparkle button wash", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const primaryCommandRule = themeCss.slice(themeCss.indexOf(".primary-command {"), themeCss.indexOf(".action-strip .primary-command"));
|
|
|
|
expect(themeCss).toContain("--control-surface");
|
|
expect(themeCss).toContain("--primary-command-surface");
|
|
expect(themeCss).not.toContain("background: var(--jelly-highlight), var(--glass-wash), var(--surface-solid)");
|
|
expect(themeCss).not.toContain("linear-gradient(145deg, rgba(255, 255, 255, 0.72), transparent 36%)");
|
|
expect(primaryCommandRule).not.toContain("background-position: right 8px top 4px, center, center");
|
|
});
|
|
|
|
it("keeps magical-girl custom-background panel overlays restrained", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const customMagicalRule = themeCss.slice(
|
|
themeCss.indexOf(':root[data-custom-background="true"][data-theme-palette="magical-girl"] {'),
|
|
themeCss.indexOf(':root[data-custom-background="true"][data-theme-palette="magical-girl"] .app-sidebar')
|
|
);
|
|
|
|
expect(customMagicalRule).toContain("--frame-accessory-opacity: 0.22");
|
|
expect(customMagicalRule).toContain("rgba(22, 22, 29, 0.64)");
|
|
expect(customMagicalRule).not.toContain("255, 119, 200, 0.78");
|
|
});
|
|
|
|
it("styles runtime task progress as a dialog with staged status", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const progressRule = themeCss.slice(themeCss.indexOf(".runtime-task-backdrop"), themeCss.indexOf("/* ---- narrow screens ---- */"));
|
|
|
|
expect(progressRule).toContain(".runtime-task-panel");
|
|
expect(progressRule).toContain(".runtime-task-meter-track");
|
|
expect(progressRule).toContain(".runtime-task-stages");
|
|
expect(progressRule).toContain(".runtime-task-log");
|
|
expect(progressRule).toContain("prefers-reduced-motion");
|
|
});
|
|
|
|
it("styles operations surfaces with shared theme materials and narrow-screen collapse", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const operationsRule = themeCss.slice(themeCss.indexOf("/* ---- operations console enrichment ---- */"));
|
|
|
|
expect(operationsRule).toContain("var(--panel-material)");
|
|
expect(operationsRule).toContain(".operations-tray-panel");
|
|
expect(operationsRule).toContain("@media (max-width: 760px)");
|
|
expect(operationsRule).toContain("grid-template-columns: 1fr");
|
|
expect(operationsRule).toContain("prefers-reduced-motion");
|
|
expect(operationsRule).toContain(".operations-job-row-failed");
|
|
});
|
|
|
|
it("keeps mobile navigation off-canvas with readable vertical labels", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const mobileRule = themeCss.slice(themeCss.indexOf("/* ---- narrow screens ---- */"), themeCss.indexOf("/* A state view inside an already framed surface"));
|
|
|
|
expect(mobileRule).toContain(".mobile-sidebar-handle");
|
|
expect(mobileRule).toContain("position: fixed");
|
|
expect(mobileRule).toContain("padding: 14px 14px 14px 52px");
|
|
expect(mobileRule).toContain("transform: translateX(calc(-100% - 18px))");
|
|
expect(mobileRule).toContain(".app-sidebar-mobile-open");
|
|
expect(mobileRule).toContain("grid-template-columns: 40px minmax(0, 1fr)");
|
|
expect(mobileRule).toContain(".app-nav-copy strong");
|
|
expect(mobileRule).toContain("display: block");
|
|
});
|
|
|
|
it("keeps desktop sidebar controls pinned inside the viewport", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const shellRule = themeCss.slice(themeCss.indexOf(".app-shell {"), themeCss.indexOf(".workspace-background-layer"));
|
|
const sidebarRule = themeCss.slice(themeCss.indexOf(".app-sidebar {"), themeCss.indexOf(".app-brand {"));
|
|
|
|
expect(shellRule).toContain("min-height: 100dvh");
|
|
expect(sidebarRule).toContain("position: sticky");
|
|
expect(sidebarRule).toContain("height: 100dvh");
|
|
expect(sidebarRule).toContain("overflow-y: auto");
|
|
expect(sidebarRule).toContain("overscroll-behavior: contain");
|
|
});
|
|
|
|
it("keeps dialogs and drawers internally scrollable on short viewports", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const dialogRule = themeCss.slice(themeCss.indexOf("/* ---- drawer ---- */"), themeCss.indexOf(".plugin-detail-actions"));
|
|
const confirmStart = themeCss.indexOf("/* ---- confirm dialog ---- */");
|
|
const confirmRule = themeCss.slice(confirmStart, themeCss.indexOf(".confirm-actions {", confirmStart));
|
|
const mobileRule = themeCss.slice(themeCss.indexOf("/* ---- narrow screens ---- */"), themeCss.indexOf("/* A state view inside an already framed surface"));
|
|
|
|
expect(dialogRule).toContain(".dialog-panel-header");
|
|
expect(dialogRule).toContain(".drawer-panel > .panel-header");
|
|
expect(dialogRule).toContain("position: sticky");
|
|
expect(dialogRule).toContain("overflow-y: auto");
|
|
expect(dialogRule).toContain("overscroll-behavior: contain");
|
|
expect(confirmRule).toContain("max-height: calc(100dvh - 32px)");
|
|
expect(confirmRule).toContain("overflow-y: auto");
|
|
expect(mobileRule).toContain("max-height: calc(100dvh - 20px)");
|
|
});
|
|
|
|
it("keeps magical card decoration from becoming square background patches", () => {
|
|
const themeCss = readFileSync(new URL("./base.css", import.meta.url), "utf8");
|
|
const magicalSurfaceRule = themeCss.slice(
|
|
themeCss.indexOf(':root[data-theme-palette="magical-girl"] .metric-card'),
|
|
themeCss.indexOf(':root[data-theme-palette="magical-girl"] :where(')
|
|
);
|
|
|
|
expect(magicalSurfaceRule).toContain("background: var(--panel-material)");
|
|
expect(magicalSurfaceRule).not.toContain("background-size: 56px 56px");
|
|
expect(magicalSurfaceRule).not.toContain("background-image: var(--corner-sparkle), var(--panel-material)");
|
|
});
|
|
});
|