2026-09-29 12:58:26 +08:00
|
|
|
|
const assert = require("node:assert/strict");
|
|
|
|
|
|
const fs = require("node:fs");
|
|
|
|
|
|
const path = require("node:path");
|
|
|
|
|
|
|
|
|
|
|
|
const root = path.resolve(__dirname, "..");
|
|
|
|
|
|
const read = (file) => fs.readFileSync(path.join(root, file), "utf8");
|
|
|
|
|
|
|
|
|
|
|
|
const globals = read("src/app/globals.css");
|
|
|
|
|
|
const navigation = read("src/components/xingbang/navigation.css");
|
|
|
|
|
|
const workspace = read("src/app/data-access/workspace.css");
|
|
|
|
|
|
const assistant = read("src/components/xingbang/business-assistant.css");
|
|
|
|
|
|
const assistantComponent = read("src/components/xingbang/BusinessAssistant.tsx");
|
|
|
|
|
|
const operations = read("src/app/operations-center/operations.css");
|
|
|
|
|
|
|
|
|
|
|
|
assert.match(globals, /font-size:\s*16px/, "全局正文应提供清晰的基础字号");
|
|
|
|
|
|
assert.match(globals, /:focus-visible/, "键盘操作应有明显焦点提示");
|
2026-10-01 03:04:18 +08:00
|
|
|
|
// 不把 min-height 钉在规则首位:第四批为防模块名折行在前面加了 flex/white-space,
|
|
|
|
|
|
// 断言的是"这条规则仍设了 42px 点击区域与 14px 字号"这个意图。
|
|
|
|
|
|
assert.match(navigation, /\.xb-agent-nav a\{[^}]*min-height:42px[^}]*font-size:14px/, "主导航应扩大文字和点击区域");
|
2026-09-29 12:58:26 +08:00
|
|
|
|
assert.match(navigation, /\.xb-role-switch\{min-height:42px/, "身份选择器应保留足够大的点击区域");
|
|
|
|
|
|
assert.match(workspace, /\.ra-button\{min-height:42px[^}]*font-size:14px[^}]*font-weight:700/, "工作台按钮应清晰且易点击");
|
|
|
|
|
|
assert.match(workspace, /\.ra-button\.primary\{background:#17634c/, "主操作按钮应采用稳定的主色强调");
|
|
|
|
|
|
assert.match(workspace, /\.xb-review-final>\.ra-button:not\(\.primary\)\{border-color:#d7837b/, "退回操作应与批准操作清楚区分");
|
|
|
|
|
|
assert.match(workspace, /\.xb-panel>p,.xb-panel p,.xb-panel details\{font-size:14px/, "业务面板正文不应继续使用过小字号");
|
|
|
|
|
|
assert.match(assistant, /\.ba-messages article p\{font-size:15px/, "助手对话正文应易于阅读");
|
|
|
|
|
|
assert.match(assistant, /\.ba-messages article\.user\{width:100%;max-width:100%;margin-left:0\}/, "用户消息应占据整行以便贴右显示");
|
|
|
|
|
|
assert.match(assistant, /\.ba-messages article\.user>div\{width:100%;justify-content:flex-end/, "用户气泡内容应靠右对齐");
|
|
|
|
|
|
assert.match(assistant, /@media\(max-width:820px\)\{\.ba-messages article\.user p\{max-width:88%\}\}/, "移动端用户气泡应保留可读宽度");
|
|
|
|
|
|
assert.match(assistantComponent, /className="ba-user-icon" aria-label="本人"><UserRound/, "用户消息应显示清晰的人类图标");
|
|
|
|
|
|
assert.match(assistant, /\.ba-workspace aside button\{min-height:46px/, "助手快捷操作应有明显点击区域");
|
|
|
|
|
|
assert.match(operations, /\.td-hero-actions button,.td-hero-actions select\{height:46px/, "时效看板操作控件应易于辨认和点击");
|
|
|
|
|
|
|
|
|
|
|
|
console.log("Business UI readability checks passed");
|