Files
image-workbench-desktop/tests/home-canvas-library-test.js
qiqi 9f29996823 feat(tokens): M4-B3 首页/库 —— 删 30 条死规则 + 间距/字号收口(3.26.46)
用户能感知的:首页紧凑了一点(侧栏条目矮 4px、主标题小 2px、卡片脚注更贴底)。

死代码(本批一半工作量)
- 25 个类名在产物里 0 次 → 删 30 条规则:home-title/subtitle/new/head/kicker/
  card-main/card-check/card-rename/cats/side-foot/menu-btn/menu-sep、lib-tabs/lib-tab/lib-handle。
- 批量管理复选框:v3.22 起「点卡片=选中」,元素不渲染,两条 .iwb-home-card-check 样式还留着。
- .iwb-home-panel 叠了 5 层 padding,前 4 层全被 `.iwb-overlay .iwb-home-panel{padding:0}`
  的更高 specificity 覆盖 —— 改数字毫无反应,一并清掉。

token 化(首页/库 106 条规则)
- 间距写死 91 → 5 处,剩下全是布局值(版心 max(24px,calc(...))、1580px、对齐导航栏的 52px),
  规范里逐条写明「为什么必须写死」。
- 字号写死清零:14→md、16→lg、18→xl、26→display;新增 --iwb-font-display:24px 第 7 档
  (26 压到 2xl(20) 会与面板标题同级,页面层级会塌)。
- 保留 .iwb-lib-*:它不是死代码,是 promptlib/grouplib 复用的插件契约 —— 只按 dist 计数会误删。

验收
- 计算样式逐元素 diff:首页 20 个元素采样,9 个变化全部是预期项,无意外属性。
- 12 张视觉基线:只首页亮/暗 2 张变化(已核对无裁切/重叠/换行错位),其余 10 张 0 diff。
- 单测里钉像素值的断言改钉 token 档位(font-size: var(--iwb-font-lg)),语义升级。
- verify:ci 全绿;token 审计:字号写死 268→243、间距 629→548、圆角 164→139、style.css 2391→2339 行。
2026-11-23 15:53:28 +08:00

17 lines
1.1 KiB
JavaScript
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.
'use strict'
const assert = require('assert')
const fs = require('fs')
const path = require('path')
const source = fs.readFileSync(path.join(__dirname, '..', 'app.js'), 'utf8')
const css = fs.readFileSync(path.join(__dirname, '..', 'style.css'), 'utf8')
for (const text of ['导出选中', '删除选中', '导入画布', '新建画布', '重命名画布', '删除画布', '设置分类', '清空回收站']) assert.ok(source.includes(text), text)
assert.ok(!source.includes("className: 'iwb-home-card-check'"))
assert.ok(source.includes('const [homeSelectedWs, setHomeSelectedWs] = useState([])'))
assert.ok(source.includes('homeSelectedWs.includes(w.id)'))
assert.ok(source.includes("homeSelectedWs.forEach((id) => (homeView === 'trash' ? purgeWs(id) : trashWs(id)))"))
// v3.26.46(M4-B3):首页头部是「左侧栏 + 主区」两栏,旧的 .iwb-home-head 已无生产者(DOM 里 0 次),
// 断言改为钉真正在用的布局类。
assert.ok(css.includes('.iwb-home-side {') && css.includes('.iwb-home-main {'))
assert.ok(css.includes('.iwb-home-card-actions'))
console.log('home canvas library checks passed')