Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/frontend/packages/swarm-ui/test/visually-hidden-css.test.mjs

18 lines
715 B
JavaScript

// The shell's hidden `<h1>` is styled by the shell's own stylesheet, so every
// page on it (the swarm UI and the hive dashboard) hides it. Run by `npm test`.
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { test } from "node:test";
const read = (path) => readFileSync(new URL(path, import.meta.url), "utf8");
test("the shell's stylesheet hides the page heading it draws", () => {
assert.match(
read("../../shared/src/app-shell/AppShell.css"),
/\.ui-visually-hidden \{[^}]*clip-path: inset\(50%\)/,
);
});
test("a page's own stylesheet doesn't define it a second time", () => {
assert.doesNotMatch(read("../src/swarm-ui.css"), /\.ui-visually-hidden/);
});