mirror of
https://github.com/nianzhibai/91.git
synced 2026-06-15 00:44:30 +08:00
7540371838
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.
35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
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-flex(mobile 段不重写 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*</);
|
||
});
|