83 lines
6.4 KiB
JavaScript
83 lines
6.4 KiB
JavaScript
'use strict'
|
||
const assert = require('assert')
|
||
const fs = require('fs')
|
||
const path = require('path')
|
||
// P2-9 组件抽取:UI 组件已收编到 src/ui-*.js —— 合并扫描(标记可能位于任一文件)
|
||
// 2026-11-07:统一源文本入口(app.js + src/ui-*.js);语义与原先手写扫描完全一致
|
||
const { uiAllSrc } = require('./_helpers/source')
|
||
const source = uiAllSrc()
|
||
// ── 2026-10-27 P0 还债:以下 className 源码钉点已删除 ─────────────────────────
|
||
// 它们原本用 `source.includes("className: 'iwb-xxx'")` 保护外壳结构 —— 写法一改就红,
|
||
// 却证明不了该 class 真的渲染出来。现由 tests/shell-render-behavior-test.js
|
||
// 用 jsdom 真跑 app.js 断言「class 确实出现在对应视图的 DOM 上」,并额外断言
|
||
// 「不该出现的视图里不出现」(如首页不应有 .iwb-canvas-topbar / .iwb-fullmask)。
|
||
// 被替换的 class:iwb-home-side / iwb-home-panel / iwb-canvas-topbar / iwb-fullmask /
|
||
// iwb-res-tab / iwb-home-card-title / iwb-home-card-foot / iwb-canvas-meta
|
||
const css = fs.readFileSync(path.join(__dirname, '..', 'style.css'), 'utf8')
|
||
assert.ok(source.includes("lsRawGet('iwb_shell_view'")) // 2026-11-06 存储收敛:改为统一 helper 入口
|
||
assert.ok(source.includes("panel: '<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\"/><path d=\"M9 3v18\"/>'"))
|
||
assert.ok(source.includes("const [enteringWs, setEnteringWs] = useState(false)"))
|
||
assert.ok(source.includes("className: 'iwb-enter-loading'"))
|
||
// v3.1.0:顶栏「我的画布」调色板图标已删(双入口冗余);回首页入口=标签条房子图标
|
||
assert.ok(!source.includes("title: '我的画布', onClick: () => goHome()"))
|
||
assert.ok(source.includes("title: '画布库(首页)'"))
|
||
// v3.1.0 配色三层:标签条=chrome 过渡色;首页(左栏+主区)=更暗的 home-bg(与顶栏区分);卡片/弹层=白 panel
|
||
assert.ok(css.includes('--iwb-chrome: color-mix('))
|
||
assert.ok(css.includes('background: var(--iwb-chrome)'))
|
||
assert.ok(css.includes('background: var(--iwb-home-bg)'))
|
||
// v3.1.0-pre.26:首页底色提亮一档(画布色↔顶栏色之间 35/65 混色),仍暗于顶栏
|
||
assert.ok(css.includes('--iwb-home-bg: color-mix(in srgb, var(--iwb-bg) 35%, var(--iwb-canvas-bg) 65%)'))
|
||
// 首页细分隔线用 --iwb-hr(暗底上不隐形)
|
||
assert.ok(css.includes('border-right: 1px solid var(--iwb-hr)'))
|
||
assert.ok(!source.includes("className: 'iwb-top-nav-icon', title: '运行全部生图节点'"))
|
||
assert.ok(!source.includes("className: 'iwb-statusbar'"))
|
||
assert.ok(!source.includes("title: '首页'"))
|
||
assert.ok(source.includes("title: '切换主题样式'"))
|
||
assert.ok(source.includes('const openCanvasEditor = (id) =>'))
|
||
assert.ok(source.includes('if (homeManage) toggleHomeSel(w.id); else setHomeSelectedWs([w.id])'))
|
||
assert.ok(source.includes('if (!homeManage) openCanvasEditor(w.id)'))
|
||
assert.ok(source.includes("iwb-rename-input"))
|
||
assert.ok(source.includes("'确定彻底删除画布「' + (w.name || '未命名画布') + '」?此操作不可恢复。'"))
|
||
assert.ok(!source.includes('Codex 未连接'))
|
||
assert.ok(css.includes('.iwb-res-tabs'))
|
||
assert.ok(css.includes('.iwb-home-card-title strong { font-size: 15px;'))
|
||
// v3.1.0 首页灰色系:蓝 accent 清零(激活项/胶囊/chip/星标全走墨色或灰阶)
|
||
assert.ok(/\.iwb-tab-home\.iwb-tab-active \{[^}]*background: transparent/.test(css)) // 首页按钮无选中底色
|
||
assert.ok(/\.iwb-home-card \{[^}]*color-mix\(in srgb, var\(--iwb-panel\) 52%, var\(--iwb-home-bg\) 48%\)/.test(css)) // v3.1.0-pre.26:卡片随底色提亮,仍亮于首页底
|
||
assert.ok(!source.includes('iwb-home-card-active')) // 无「默认必有一个选中卡」的伪选中态
|
||
assert.ok(!/\.iwb-home-card-cat \{[^}]*iwb-brand/.test(css))
|
||
assert.ok(!/\.iwb-home-side-item\.active \{[^}]*iwb-brand/.test(css))
|
||
// 分类栏计数去底色:只显示数字
|
||
assert.ok(!/\.iwb-home-side-count \{[^}]*background: var\(--iwb-layer2\)/.test(css))
|
||
// v3.1.0 细节轮:auto-fill 随宽度增列(min 230px);滚动条浅灰底;右上按钮默认灰/主动作深灰;搜索框不再纯白
|
||
assert.ok(css.includes('grid-template-columns: repeat(auto-fill, minmax(230px, 1fr))'))
|
||
assert.ok(css.includes('::-webkit-scrollbar-track'))
|
||
assert.ok(/\.iwb-home-main-head \.iwb-btn \{[^}]*color-mix/.test(css))
|
||
assert.ok(/\.iwb-home-main-head \.iwb-btn-primary \{[^}]*var\(--iwb-text2\)/.test(css))
|
||
assert.ok(/\.iwb-home-search \.iwb-input \{[^}]*color-mix/.test(css))
|
||
// v3.1.0 全灰阶收口:品牌 token=同亮度灰;画布选中标签=亮灰;app 内无蓝色 hex(节点色/连线)
|
||
assert.ok(css.includes('--iwb-brand: #6b7280'))
|
||
assert.ok(/\.iwb-tab-active \{ background: color-mix\(in srgb, var\(--iwb-text\) 9%, transparent\)/.test(css))
|
||
assert.ok(!/(#4f6ef7|#6366f1|#3b82f6|#0ea5e9|#8b5cf6)/i.test(css))
|
||
assert.ok(!/(#4f6ef7|#6366f1|#3b82f6|#0ea5e9|#8b5cf6|#f59e0b|#10b981)/i.test(source))
|
||
// v3.1.0 资源中心面板灰阶化:选中分类胶囊=浅白灰、标签/星标/页签/高亮全去蓝;首页改名按钮去底色
|
||
assert.ok(!/\.iwb-chip-active \{[^}]*iwb-brand/.test(css))
|
||
assert.ok(/\.iwb-chip-active \{[^}]*background: var\(--iwb-panel\)/.test(css))
|
||
assert.ok(!/\.iwb-tag \{[^}]*iwb-brand/.test(css))
|
||
assert.ok(!/\.iwb-btn-starred \{[^}]*iwb-brand/.test(css))
|
||
assert.ok(!/\.iwb-res-tab-active \{[^}]*iwb-brand/.test(css))
|
||
assert.ok(!/\.iwb-hl \{[^}]*iwb-brand/.test(css))
|
||
assert.ok(/\.iwb-home-main-head \.iwb-btn-sm \{[^}]*background: transparent/.test(css))
|
||
assert.ok(css.includes('.iwb-enter-spinner'))
|
||
assert.ok(css.includes('.iwb-overlay.drawer-open .iwb-canvas { left: 0 !important;'))
|
||
assert.ok(!css.includes('.iwb-left-drawer'))
|
||
assert.ok(!source.includes("className: 'iwb-resource-rail'"))
|
||
assert.ok(!source.includes("className: 'iwb-canvas-expand'"))
|
||
assert.ok(source.includes("title: '资源中心(提示词库/节点组/图库)'"))
|
||
assert.ok(css.includes('.iwb-landing-actions .iwb-btn { min-height: 42px;'))
|
||
assert.ok(css.includes('.iwb-home-card-actions { opacity: 0;'))
|
||
assert.ok(css.includes('.iwb-home-card.iwb-manage .iwb-home-card-check { display: inline-block; }'))
|
||
assert.ok(css.includes('.iwb-home-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));'))
|
||
assert.ok(css.includes('.iwb-home-card-foot small { color: var(--iwb-text2); font-size: 12px; line-height: 1.4; white-space: nowrap;'))
|
||
console.log('page chrome regression checks passed')
|