Files
91/tests/navigationUi.test.ts
nianzhibai 7540371838 feat: restore tag classification and drive controls
Restore the previous fixed-tag classification flow, including startup backfill for existing videos and the 91porn spider tag.

Also commit the current drive scanning, preview scheduling, and admin drive-control updates present in the workspace.
2026-05-28 12:18:17 +08:00

35 lines
1.3 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
const navigationCss = readFileSync(
new URL("../src/styles/navigation.css", import.meta.url),
"utf8"
);
const topBarSource = readFileSync(
new URL("../src/components/TopBar.tsx", import.meta.url),
"utf8"
);
function ruleBody(css: string, selector: string): string {
const escapedSelector = selector.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const match = css.match(new RegExp(`${escapedSelector}\\s*\\{([^}]*)\\}`));
assert.ok(match, `Expected CSS rule for ${selector}`);
return match[1];
}
test("mobile menu links fill the full expanded menu row", () => {
// 默认 .main-nav__link 用 inline-flexmobile 段不重写 display,所以仍是 flex 容器)。
const baseBody = ruleBody(navigationCss, ".main-nav__link");
assert.match(baseBody, /display\s*:\s*(?:inline-)?flex\b/);
// mobile 展开态把链接铺满整行。
const openBody = ruleBody(navigationCss, ".main-nav.is-open .main-nav__link");
assert.match(openBody, /width\s*:\s*100%/);
});
test("top bar does not render inactive public auth links", () => {
assert.doesNotMatch(topBarSource, /href="#(?:register|login)"/);
assert.doesNotMatch(topBarSource, />\s*(?:注册|登录)\s*</);
});