Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

fix(admin): keep the hidden utility from losing to component display rules

Josh France6e8264f5346a
diff --git a/plugins/admin/public/index.html b/plugins/admin/public/index.html
index e776937c2..fc63aa97e 100644
--- a/plugins/admin/public/index.html
+++ b/plugins/admin/public/index.html
@@ -209,9 +209,6 @@
grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
min-height: calc(100dvh - var(--header-total-h));
}
- .admin-app.hidden {
- display: none;
- }
.admin-sidebar {
position: sticky;
top: var(--header-total-h);
@@ -692,9 +689,6 @@
background: var(--surface);
box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
}
- .scope-menu.hidden {
- display: none;
- }
.scope-menu .scope-filter {
padding: 8px;
border-bottom: 1px solid var(--border);
@@ -1075,9 +1069,6 @@
flex-wrap: wrap;
margin: 0 0 10px;
}
- .pack-adv.hidden {
- display: none;
- }
.pack-adv input {
flex: 1 1 150px;
min-width: 0;
@@ -1129,9 +1120,6 @@
border-radius: 8px;
box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}
- .ovmenu.hidden {
- display: none;
- }
.ovmenu button {
text-align: left;
border: none;
@@ -1190,9 +1178,6 @@
width: 36px;
height: 28px;
}
- .dense-row.hidden {
- display: none;
- }
.scope-link {
border: 0;
padding: 0;
@@ -1366,7 +1351,7 @@
font-variant-numeric: tabular-nums;
}
.hidden {
- display: none;
+ display: none !important;
}
tr.openable {
@@ -3128,9 +3113,6 @@
#view-governance section.card.setting-row {
padding: 12px 14px;
}
- #view-governance .setting-row.hidden {
- display: none;
- }
#view-governance .setting-row > .head {
display: block;
margin: 0;
diff --git a/plugins/admin/test/default-view.test.ts b/plugins/admin/test/default-view.test.ts
index e40bfae1c..6a546b643 100644
--- a/plugins/admin/test/default-view.test.ts
+++ b/plugins/admin/test/default-view.test.ts
@@ -4,6 +4,31 @@ import test from "node:test";
const html = readFileSync(new URL("../public/index.html", import.meta.url), "utf8");
+function resolvedDisplay(classes: string[]) {
+ const styles = [...html.matchAll(/<style>([\s\S]*?)<\/style>/g)].map((m) => m[1]).join("\n");
+ const held = new Set(classes);
+ let display = "";
+ let important = false;
+ for (const [, selectors, body] of styles.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
+ const matches = selectors.split(",").some(
+ (selector) =>
+ /^(\.[A-Za-z0-9_-]+)+$/.test(selector.trim()) &&
+ selector
+ .trim()
+ .split(".")
+ .filter(Boolean)
+ .every((name) => held.has(name)),
+ );
+ if (!matches) continue;
+ for (const [, value, bang] of body.matchAll(/display:\s*([a-z-]+)\s*(!important)?\s*;/g)) {
+ if (important && !bang) continue;
+ display = value;
+ important = !!bang;
+ }
+ }
+ return display;
+}
+
test("admin shell uses the QM identity with org-injectable branding", () => {
assert.match(html, /<title>QM Admin<\/title>/);
assert.match(html, /<meta name="brand-self-label" content="Agent" \/>/);
@@ -186,7 +211,7 @@ test("compact governance rows preserve policy detail and collapse before they ov
);
assert.match(html, /#view-governance \.setting-row > \.foot \.status[^}]*overflow-wrap: anywhere/);
assert.match(html, /#view-governance section\.card\.setting-row\s*\{\s*padding:\s*12px 14px;\s*\}/);
- assert.match(html, /#view-governance \.setting-row\.hidden\s*\{\s*display:\s*none;\s*\}/);
+ assert.equal(resolvedDisplay(["setting-row", "hidden"]), "none");
});
test("governance reviews high-impact changes in product and preserves drafts", () => {
@@ -311,3 +336,13 @@ test("governance SOUL workbench shows draft diff, history, and conflict-safe res
assert.match(html, /function refreshSoulConflict\(\)/);
assert.match(html, /Restore SOUL version/);
});
+
+test("the hidden utility hides an element whose component rule is declared later", () => {
+ assert.match(html, /<aside class="environment-notice hidden" id="environment-notice"/);
+ assert.match(html, /notice\.classList\.toggle\("hidden", !attachment\)/);
+ assert.equal(resolvedDisplay(["environment-notice"]), "flex");
+ assert.equal(resolvedDisplay(["environment-notice", "hidden"]), "none");
+ for (const component of ["admin-app", "scope-menu", "pack-adv", "ovmenu", "dense-row", "setting-row"]) {
+ assert.equal(resolvedDisplay([component, "hidden"]), "none");
+ }
+});