fix(shell): 退出按钮加 flex-shrink:0/nowrap,长用户名下不再竖排(#75) - #76
Merged
Conversation
- .shell-logout 永不收缩、文案单行,超宽压力转嫁用户名 ellipsis 截断 - apps/shell/vite.config.ts 开 test.css:true,jsdom getComputedStyle 可级联 scoped CSS - App.test.ts 新增长/短用户名布局契约用例(破坏性回验:移除任一属性即红) Signed-off-by: HandyWote <huangyinghui01@corp.netease.com>
Contributor
Author
真机像素证据(agent-browser / Chromium 真实渲染)viewport 1280×633,dpr 1;被测元素
补充(C 组 footer):footer 宽 219px; 截图:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
Closes #75
侧栏 footer 的退出按钮在长用户名(邮箱截断显示)下被
flex-shrink压窄,「退出」按 CJK min-content 逐字换行 → 竖排。根因:用户名过长使 footer 一行超宽,flex-shrink把.shell-logout从约 62px 压到约 49px。改动
apps/shell/src/App.vue.shell-logout增加flex-shrink: 0; white-space: nowrap;——按钮永不收缩,超宽压力按设计转嫁给用户名ellipsis截断apps/shell/vite.config.tscss: true,使 jsdom 的getComputedStyle能级联到 SFC scoped CSS(组件级布局回归的前提)apps/shell/src/App.test.ts关于验收标准 1 的一处偏差(请评审知悉)
issue 验收标准 1 写的是
getBoundingClientRect().width ≥ 60。jsdom 不实现布局,getBoundingClientRect()恒返回0×0(本 PR 已实测确认),该断言在@vue/test-utils + jsdom下不可执行(恒假)。因此组件级测试采用可执行、且与修复因果绑定的等价契约断言:.shell-logoutcomputedflex-shrink === '0'(不被压窄).shell-logoutcomputedwhite-space === 'nowrap'(文案不换行/不竖排).shell-logoutcomputedheight === '30px',文案完整为「退出」.shell-user-namecomputedoverflow: hidden+text-overflow: ellipsis(压力去处)真实像素(宽度 49→62、单行)由 agent-browser 真机证据补充,见 PR 评论。
破坏性回验(红 → 绿)
flex-shrink: 0expected '' to be '0'white-space: nowrapexpected '' to be 'nowrap'@unself/shell43/43 绿验收对照表
App.test.ts新增 2 用例(长名handy@unself.demo.example/ 短名黄一),断言上列契约;jsdom 布局限制与真机证据见上flex-shrink:0→ 测试红 → 还原绿m0/dev;不合并;中文描述 + 验收对照表m0/dev;本 PR 不合并三件套验证(issue #75 · m0/issue-75)
typecheck ✅
pnpm -r typecheckEXIT=0 —— 7/8 项目全过(contracts / ui / shell / cloudflare / module-sdk / core-api / hello)。test ✅
pnpm -r testEXIT=0 —— 7 包 31 文件 267 用例全绿:apps/shell 43 · deploy/cloudflare 69 · modules/hello 12 · packages/contracts 23 · packages/module-sdk 39 · packages/ui 7 · services/core-api 74。
#75 新用例(@unself/shell · verbose 逐名确认):
build ✅
pnpm -r buildEXIT=0 —— 7 包全过;产物:packages/uidist(index.css 5.53 kB / index.js 6.16 kB)、apps/shelldist(index.html + index-HAX6bGJC.css 19.59 kB + index-D_KFHRjM.js 210.58 kB)。工作区卫生:
git status --short仅 #75 三文件,无额外跟踪文件改动;dist/ 均在 gitignore 内。真机证据
见 PR 评论(agent-browser 实测:修复前长名按钮约 49px + 竖排;修复后约 62px + 单行;短名基线约 62px 单行)。