fix(style-source): 修面板在真实宿主里被撑宽裁切 + 容器尺寸兜底
- 根因:.iwb-full-panel-plugin 是裸 div(宿主无样式),flex 子项 min-width 默认 auto, 13 个分类 chip 单行不换行的 max-content 约 955px,把容器顶到 955, 资源中心窗口只有 918 ⇒ 搜索框/刷新按钮/chips 尾巴/状态栏全被裁在右边 - mount 时给容器补 min-width:0 + min-height:0 + height:100% + overflow:hidden (只给收缩许可,不写 flex:1 —— 资源中心是 flex row、侧栏是 flex column,语义不同) - chips 自身再加 min-width:0 / max-width:100% 双保险 - harness 加两条「无水平溢出」断言(窄档/宽档),host 不再预置 min-width:0 以真实复现 - 真实站点复验:容器 918 = 面板 918,overflowX=0,卡片图片/名称全部正常
This commit is contained in:
1 parent
38a34ff533
commit
98f66ccaf8
2 files changed
+27
-2
No files matched your search
@@ -150,7 +150,7 @@ async function main() {
|
||||
const stage = document.getElementById('stage')
|
||||
const host = document.createElement('div')
|
||||
host.id = 'hostA'
|
||||
host.style.cssText = 'width:320px;height:640px;display:flex;min-width:0'
|
||||
host.style.cssText = 'width:320px;height:640px'
|
||||
stage.appendChild(host)
|
||||
panel.mount(host)
|
||||
window.__hostA = host
|
||||
@@ -185,6 +185,13 @@ async function main() {
|
||||
'card=' + geom.cardH + ' img=' + geom.imgH)
|
||||
check('卡片名称可见', geom.nameH >= 10 && geom.name.length > 0, geom.name + ' / h=' + geom.nameH)
|
||||
|
||||
// 回归守门:13 个 chip 不换行,max-content 近 950px,要把祖先容器顶宽(真实宿主窗口只有 680,右侧全被裁)
|
||||
const ov1 = await page.evaluate(() => {
|
||||
const r = document.querySelector('#hostA .iwb-ss-root')
|
||||
return { sw: r.scrollWidth, cw: r.clientWidth }
|
||||
})
|
||||
check('窄档无水平溢出(chip max-content 不顶宽容器)', ov1.sw <= ov1.cw + 1, 'scrollW=' + ov1.sw + ' clientW=' + ov1.cw)
|
||||
|
||||
// ---- 默认窄档 ----
|
||||
const layoutNarrow = await page.evaluate(() => window.__hostA.querySelector('.iwb-ss-root').getAttribute('data-layout'))
|
||||
check('320px 初始为 narrow', layoutNarrow === 'narrow', String(layoutNarrow))
|
||||
@@ -255,6 +262,12 @@ async function main() {
|
||||
check('宽档详情占比约 46%', wideDetail.ratio > 0.3 && wideDetail.ratio < 0.5, wideDetail.ratio.toFixed(2))
|
||||
check('宽档网格列数增加', wideDetail.cols >= 4, 'cols=' + wideDetail.cols)
|
||||
|
||||
const ov2 = await page.evaluate(() => {
|
||||
const r = document.querySelector('#hostA .iwb-ss-root')
|
||||
return { sw: r.scrollWidth, cw: r.clientWidth }
|
||||
})
|
||||
check('宽档无水平溢出', ov2.sw <= ov2.cw + 1, 'scrollW=' + ov2.sw + ' clientW=' + ov2.cw)
|
||||
|
||||
// ---- 恢复窄档,测边界:479/480 ----
|
||||
await page.evaluate(() => { window.__hostA.style.width = '479px' })
|
||||
const at479 = await poll(async () => {
|
||||
@@ -303,7 +316,7 @@ async function main() {
|
||||
const stage = document.getElementById('stage')
|
||||
const hostB = document.createElement('div')
|
||||
hostB.id = 'hostB'
|
||||
hostB.style.cssText = 'width:920px;height:600px;display:flex;min-width:0'
|
||||
hostB.style.cssText = 'width:920px;height:600px'
|
||||
stage.appendChild(hostB)
|
||||
window.__calls.panels[0].mount(hostB)
|
||||
window.__hostB = hostB
|
||||
|
||||
Reference in new issue
Block a user