新增 getBrandPrimaryColor / getBrandPrimaryColorWithAlpha / getInitialBrandFromBrowser / syncBrandClassName 的单元测试,以及 brand-default / brand-sxwz CSS 选择器存在性校验。
14 lines
518 B
TypeScript
14 lines
518 B
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import test from "node:test";
|
|
import url from "node:url";
|
|
|
|
const currentDir = path.dirname(url.fileURLToPath(import.meta.url));
|
|
const globalsCss = readFileSync(path.join(currentDir, "globals.css"), "utf8");
|
|
|
|
void test("brand selectors target :root to outrank default root variables", () => {
|
|
assert.match(globalsCss, /:root\.brand-default\s*\{/);
|
|
assert.match(globalsCss, /:root\.brand-sxwz\s*\{/);
|
|
});
|