Files
image-workbench-desktop/tests/left-resource-layout-test.js
T
qiqi 540da6deba fix(dock/gallery): 图库图幅自适应重做 + 左右栏快捷键 n/t + 面板层级与滚轮修正 v3.25.38
- 图库列数改为按「面板宽 / 图幅」计算(图幅可选 110/130/170/220,默认 130,持久化),
  同一图幅下列宽稳定、只靠增减列数适应面板宽度;去掉 460px 上下限(竖图不再被 letterbox 缩成小图)
- 图库头部 flex-wrap:窄面板自动两行,按钮不被挤压
- n = 右栏开合、t = 左栏开合;顶栏「图库」按钮与其快捷键一并下线(帮助/设置文案同步)
- 左右栏从标签条下方开始(top:36px),标签条恢复满宽并压在面板之上;首页/落地页隐藏停靠栏
  (原生子 webview 因 rect 归零被 park,不再盖住首页)
- 停靠栏在 .iwb-canvas 内 ⇒ 面板根节点吞掉 wheel/pointerdown/contextmenu,画布 wheel 白名单补
  .iwb-dock;图库网格 overscroll-behavior:contain
- 图库宽度测量改为可重挂(面板延迟挂载时不再固定按 300 计算列宽)
2026-11-20 06:44:16 +08:00

33 lines
2.1 KiB
JavaScript
Raw 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')
// P2-9 组件抽取:左资源栏(LibSidebar)已收编到 src/ui-lib-sidebar.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 上」,语义更强且允许自由重写 JSX。
// 被替换的 class:iwb-home-side / iwb-home-panel / iwb-canvas-topbar / iwb-fullmask /
// iwb-res-tab / iwb-product-nav(详见 docs/history/source-pin-audit-2026-10-27.md)
const css = fs.readFileSync(path.join(__dirname, '..', 'style.css'), 'utf8')
assert.ok(source.includes("panels: dockPanels"))
assert.ok(source.includes("storageKey: 'iwb.dock.v1'"))
// v3.25.38:顶栏「图库」按钮已删;开关统一在顶栏两端(左/右栏),快捷键 n / t
assert.ok(!source.includes("title: '图库(右侧栏)'"))
assert.ok(source.includes("title: '显示 / 隐藏右栏'"))
assert.ok(source.includes("toggleLeftDock"))
assert.ok(!source.includes("className: 'iwb-resource-rail'"))
assert.ok(!source.includes("className: 'iwb-left-drawer'"))
assert.ok(!source.includes("className: 'iwb-canvas-expand'"))
assert.ok(!source.includes("className: 'iwb-resource-float'"))
assert.ok(source.includes("onRightOpen: (v) => setDrawerOpen(v)"))
assert.ok(source.includes("resourceTab === 'prompts'"))
assert.ok(!css.includes('.iwb-leftrail'))
assert.ok(css.includes('.iwb-res-tabs {'))
assert.ok(css.includes('.iwb-res-tab-active {'))
assert.ok(css.includes('.iwb-overlay.drawer-open .iwb-canvas { left: 0 !important;'))
console.log('left resource layout checks passed')