39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { existsSync, readFileSync } from "node:fs";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import test from "node:test";
|
|
|
|
const appRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const loginPagePath = resolve(appRoot, "src/pages/login.vue");
|
|
const loginPageSource = readFileSync(loginPagePath, "utf8");
|
|
|
|
test("APP 登录页沿用 PC 端的品牌背景与登录卡片结构", () => {
|
|
assert.match(loginPageSource, /class="login-page"/);
|
|
assert.match(loginPageSource, /\/static\/login-background\.jpg/);
|
|
assert.match(loginPageSource, /class="login-card"/);
|
|
assert.match(loginPageSource, /globalConfig\.appInfo\.name/);
|
|
assert.doesNotMatch(
|
|
loginPageSource,
|
|
/bg-gradient-to-br from-blue-50 to-indigo-100/,
|
|
);
|
|
assert.ok(
|
|
existsSync(resolve(appRoot, "src/static/login-background.jpg")),
|
|
"APP 登录页需要包含与 PC 端一致的背景资源",
|
|
);
|
|
});
|
|
|
|
test("APP 登录页保留验证码刷新与回车登录交互", () => {
|
|
assert.match(loginPageSource, /@click="getCode"/);
|
|
assert.match(loginPageSource, /@confirm="handleLogin"/);
|
|
assert.match(loginPageSource, /captchaEnabled/);
|
|
});
|
|
|
|
test("APP 登录页为白色 Sylvan 字标提供深色承载层", () => {
|
|
assert.match(loginPageSource, /class="brand-logo-frame"/);
|
|
assert.match(
|
|
loginPageSource,
|
|
/\.brand-logo-frame\s*\{[\s\S]*background:\s*#28225c/,
|
|
);
|
|
});
|