Files
Unraid-AppOps-Gateway-Public/src/lib/accessibilityShell.test.ts
T

30 lines
1.5 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { describe, it } from "node:test";
const shell = readFileSync(new URL("../components/AppShell.tsx", import.meta.url), "utf8");
const banner = readFileSync(new URL("../components/OperatorReadOnlyBanner.tsx", import.meta.url), "utf8");
const styles = readFileSync(new URL("../globals.css", import.meta.url), "utf8");
const notifications = readFileSync(new URL("../pages/Notifications.tsx", import.meta.url), "utf8");
describe("accessible operator shell", () => {
it("offers a keyboard-visible skip link to the focusable main landmark", () => {
assert.match(shell, /href="#main-content"/);
assert.match(shell, /<main id="main-content" tabIndex=\{-1\}/);
assert.match(styles, /\.app-skip-link:focus/);
});
it("announces read-only state without claiming the status data is locked", () => {
assert.match(banner, /role="status" aria-live="polite"/);
assert.match(banner, /Alleen lezen/);
assert.match(banner, /Je beheerder kan extra rechten toekennen/);
assert.doesNotMatch(banner, /ontgrendel|operator-token/i);
});
it("keeps notification mutations and write-only channel fields locked without notification permissions", () => {
assert.match(notifications, /const unlocked = usePermission\("notifications.manage"\)/);
assert.match(notifications, /disabled=\{!unlocked \|\| working !== null\}/);
assert.match(notifications, /disabled=\{!unlocked\} className="border-slate-800 bg-slate-950 text-slate-100"/);
});
});