import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; function read(path) { return readFileSync(new URL(`../${path}`, import.meta.url), "utf8"); } function ruleBlock(source, selector) { const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); const match = source.match(new RegExp(`${escaped}\\s*\\{[\\s\\S]*?\\n\\}`, "m")); assert.ok(match, `Expected to find CSS block for ${selector}`); return match[0]; } function assertNoDeclaration(block, property) { assert.ok(!new RegExp(`\\b${property}\\s*:`, "m").test(block), `Unexpected ${property} declaration in:\n${block}`); } const mainCss = read("src/styles/main.css"); const purchaseOrderView = read("src/views/PurchaseOrderView.vue"); const salesPlanningView = read("src/views/SalesPlanningView.vue"); const orgMindMap = read("src/components/OrgMindMap.vue"); assertNoDeclaration(ruleBlock(mainCss, ".workflow-drawer"), "border-left"); assertNoDeclaration(ruleBlock(mainCss, "body .login-console-frame"), "border-left"); assertNoDeclaration(ruleBlock(purchaseOrderView, ".section-title"), "border-left"); assertNoDeclaration(ruleBlock(salesPlanningView, ".section-title"), "border-left"); assertNoDeclaration(ruleBlock(purchaseOrderView, ".purchase-decision-section"), "border-right"); assert.ok( !/transition:[^;]*(?:stroke-width|\br\s+[0-9.]+s)/.test(mainCss), "SVG DAG transitions should not animate stroke-width or radius-like r properties" ); assert.ok( !/transition:[^;]*(?:\bwidth\b|\bheight\b)/.test(orgMindMap), "Org mind map canvas should not animate width or height" ); console.log("ui antipattern guard ok");