feat(ui): 保时捷语法复刻收尾(ADR-0008/0009/0011/0012/0013) #65
No files matched your search
@@ -1483,7 +1483,7 @@ runbook 已加"构建失败即中止"与"发布前检查磁盘 ≥2G"。
|
||||
| ID | 事项 | 状态 | 阻塞 / 前置 | 判据(可复算) |
|
||||
|---|---|---|---|---|
|
||||
| OPEN-01 | hub 六页首屏视觉支点(原 P4 剩余 + P6 影像接线;2026-11-26 按 ADR-0011 改判为「B 类原语 × 6」) | 未闭 | 阻断理由已改写(见 §21):不再是「`AUTH-2` 无可用氛围图、需生成 ~10 张」,而是「**原语尚未实现**」——实测 `public/images/hub/` 是空目录(`total 0`)、六个 hub 组件 `<Image` 命中数均为 0 | 三条(ADR-0011 §5):①六页首屏有 B 类原语且承担构图(不可被 CSS 隐藏)②`npm run check:grammar` 21/21 全绿 ③该原语不含可辨识建筑造型(评审 + 台账声明) |
|
||||
| OPEN-02a | 导航签名·**内缩白浮条**(top **48px** / 高 **64px** / 左右对齐 `container-x`;px 令牌,不用 rem) | 未闭 | 阻塞 = **基线重采授权**:页头是唯一「改一处动 180/227 张基线」的组件(35 页 × 5 project 全页 175 + `header-navigation` × 5);另需同批改 `chrome-persistence` 的 `top===0` 断言(契约变更) | `getComputedStyle(header).top === '48px'` + 高 `64`(**不是** rem 换算值)+ 13 个导航用例全绿 + 180 张基线按 §5.58 判据重采后独立复跑全绿。裁定见 ADR-0012 §4 |
|
||||
| OPEN-02a | 导航签名·**内缩白浮条**(top **48px** / 高 **64px** / 左右对齐 `container-x`;px 令牌,不用 rem) | **已闭 2026-11-27** | — | 实测:内缩层 `paddingTop === '48px'` + 浮条 `rect.top === 48` / `height === 64`(滚动前后一致;外壳保持 `top-0`,`top===0` 契约未改,见 ADR-0012 §8.1);`chrome-persistence`+`nav-dropdown`+`nav-keyboard` **52 passed / 8 skipped**(skip 均既有);基线**实写 195 张**(非预测 180,构成见 §24.3)后独立只读复跑 **225 passed / 0 failed / EXIT=0**(最终树 9.0 分钟);`type-check` / `check:grammar` 21/21 / `check:motion` / `check:a11y` 全绿,`lint` 0 error / 88 warning(与 HEAD 同),`test:unit` 159 套件 / 1883 例。裁定与回填见 ADR-0012 §4/§8 |
|
||||
| OPEN-02b | 导航签名·滚动 >80 **收成左上白方汉堡**(原 P3 的后半) | **已判定不做 2026-11-26** | — | 翻转需四条同时满足(ADR-0012 §6):汉堡含完整双轴 + focus trap + `Esc`;原 `nav-dropdown`/`nav-keyboard` 断言**作为「展开后」子断言保留**;滚动后导航可发现性三步复算;基线按 §5.58 重采 |
|
||||
| OPEN-03 | 正文行高统一(把 `--line-height-relaxed` 收进 `.prose` 层) | 未闭 | 库里已有法律页 HTML 自带行高;统一需**写库**或重采基线,二者都要单独授权 | 层内加 `line-height` 后 `/privacy` `/terms` 视觉零差异 |
|
||||
| OPEN-04 | `/insights` 与 `/news` URL 族归并(301) | 未闭 | 需同批动 `redirects` / `@security` 断言 / sitemap / lighthouserc 四处,且会改线上 URL 契约 | 改后 `@security` + sitemap + lighthouse 同批复跑全绿 |
|
||||
@@ -1727,4 +1727,49 @@ const B_PROPAGATION = ALLOWLIST_INLINE_COLOR
|
||||
|
||||
1. **批 3 仍未做**(`OPEN-05b`,保留棘轮)。
|
||||
2. **`OPEN-16` 未修**:本轮只是删掉了实例,`dead-modules.mjs` 的 barrel 盲区仍在。
|
||||
3. **`OPEN-02a` / `OPEN-01` 原语未实施**(各自的基线成本见 ADR-0012 / ADR-0011)。
|
||||
3. **`OPEN-01` 原语仍未实施**(基线成本见 ADR-0011)。`OPEN-02a` 已于 2026-11-27 落地(见 §24)。
|
||||
|
||||
## §24 2026-11-27 · OPEN-02a 落地(内缩白浮条 + 195 张基线重采)
|
||||
|
||||
### 24.1 代码改动(4 文件)
|
||||
|
||||
| 文件 | 改动 |
|
||||
|---|---|
|
||||
| `src/app/globals.css` | 新增 **px** 令牌 `--header-inset-top: 48px` / `--header-height: 64px`(不用 rem:根字号随断点 16/17/18px 漂移) |
|
||||
| `src/components/layout/header.tsx` | 外壳改 `fixed inset-x-0 top-0` **不画底色**;内层 `padding-top: var(--header-inset-top)` 承托内缩白条(高 `--header-height`、`bg-bg-primary` + 边线);删除随滚动的 80→64 高度动画;新增 `data-header-state="top\|scrolled"`;抽屉起点改 `calc(inset + height)` |
|
||||
| `src/app/(marketing)/layout.tsx` | 内容让位 `pt-16`(64px)→ `pt-[calc(var(--header-inset-top)+var(--header-height))]`(112px) |
|
||||
| `e2e/chrome-persistence.spec.ts` | 新增「内缩浮条」用例:断言内缩层 `paddingTop === '48px'`、浮条 `height === '64px'`;桌面档再断言滚动前后 `rect.top === 48`、左右内缩、`data-header-state="scrolled"`。移动档只断言令牌解析值(`fixed` rect 在模拟视口下会漂移) |
|
||||
|
||||
### 24.2 几何读数
|
||||
|
||||
390/640/768/1024/1280/1600 六档:浮条 **top 48 / 高 64** 恒定;1600 档 **165…1435**(对标 173…1426,差 8–9px,属既有 gutter 口径)。滚动 600px 后 top/高不变。
|
||||
|
||||
### 24.3 基线(本节是「预测≠实测」的完整交代)
|
||||
|
||||
- **预测 180,实际 195**。ADR-0012 §2.3 的「35 页」已过期:`VISUAL_TEST_PAGES` 现为 **32** 页。
|
||||
- 构成:32 页 × 5 project 全页 **160** + `theme-light/dark-main` **10** + `header-navigation` **5** +
|
||||
页脚 **5** + 按钮三态 × 4 project **12** + 产品卡 **3** = **195**。
|
||||
- 页脚/按钮/卡片属**同因果外溢**:元素级截图在 scrollIntoView 后会把 fixed 页头拍入画面,
|
||||
页头由 80px 贴顶条变为「48 透空 + 64 白条」后覆盖区变了。旧/新图逐张目视确认,不是无关漂移。
|
||||
- `--update-snapshots=changed` 实写 **195** 行,与上述构成逐项相等。
|
||||
- firefox `/solutions/retail` 首跑 1 例失败且无错误详情;单独复跑通过并写入,随后只读复跑同项通过
|
||||
⇒ 判为负载偶发,不是稳定回归。
|
||||
- **独立只读复跑**:`--update-snapshots=none` ⇒ **225 passed / 0 failed / EXIT=0(最终树 9.0 分钟)**。
|
||||
|
||||
### 24.4 门禁
|
||||
|
||||
| 检查 | 读数 |
|
||||
|---|---|
|
||||
| `type-check` | EXIT=0 |
|
||||
| `lint` | 0 error / 88 warning(与 HEAD 同) |
|
||||
| `test:unit` | 159 套件 / 1883 例全过 |
|
||||
| `check:grammar` | 21/21 |
|
||||
| `check:motion` | 违规 0 |
|
||||
| `check:a11y` | EXIT=0 |
|
||||
| 导航三 spec | 52 passed / 8 skipped(既有条件) |
|
||||
|
||||
### 24.5 仍未做
|
||||
|
||||
1. `OPEN-02b`(滚动收方汉堡)维持「不做」,翻转需 ADR-0012 §6 四条同时满足。
|
||||
2. 1600 档左右边界的 8–9px 差异未修(要动 `max-w-container`/gutter 真源,影响全站容器)。
|
||||
3. `OPEN-01`(hub 六页 B 类原语)仍未实施。
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
## 状态
|
||||
|
||||
已裁定(2026-11-26)。**实施未开始**:`02a` 一旦落地会令 180 张视觉基线失效,需单独授权重采。
|
||||
已裁定并实施(2026-11-26 裁定 / 2026-11-27 落地)。`02a` 已合入:px 令牌 + 内缩浮条 + e2e 契约;
|
||||
195 张基线经授权重采并独立只读复验通过(225 passed / 0 failed)。§4 的判据已按实施形状回填(§8)。
|
||||
本 ADR 把 `OPEN-02`(原 `P3` / `AUTH-3`)拆成 `02a` / `02b` 两项,其中 `02b` 判为**不做**。
|
||||
|
||||
## 1. 结论
|
||||
@@ -36,7 +37,7 @@ Porsche Consulting 中国站:**白底内缩浮条,x=173…1426 / 高 64 / to
|
||||
| 项 | 数量 | 说明 |
|
||||
|---|---|---|
|
||||
| 视觉基线总数 | **227** | `find e2e/visual-snapshots -name "*.png" \| wc -l` |
|
||||
| 含页头的基线 | **180** | 35 页 × 5 project 全页截图(175,页头是 fixed,必然入画)+ `header-navigation` 元素基线 × 5 |
|
||||
| 含页头的基线 | **180**(⚠ 实施实测 **195**,见 §8.3) | 35 页 × 5 project 全页截图(175,页头是 fixed,必然入画)+ `header-navigation` 元素基线 × 5。实施时页面分母实为 32,且主题页与元素级截图也会把 fixed 页头拍入画 |
|
||||
| 受影响的导航用例 | **13** | `nav-dropdown` 4 + `nav-keyboard` 6 + `chrome-persistence` 3 |
|
||||
| 其中硬断「贴顶」的 | 1 处 | `e2e/chrome-persistence.spec.ts` 断言页头滚动后 `top === 0` |
|
||||
|
||||
@@ -83,12 +84,12 @@ Porsche Consulting 中国站:**白底内缩浮条,x=173…1426 / 高 64 / to
|
||||
|
||||
| 项 | 值 | 判据 |
|
||||
|---|---|---|
|
||||
| 顶距 | `48px`(`--header-inset-top`) | `getComputedStyle(header).top === '48px'`(**不是** rem 换算值) |
|
||||
| 顶距 | `48px`(`--header-inset-top`) | 内缩层 `getComputedStyle(div).paddingTop === '48px'` + 浮条 `rect.top === 48`(**不是** rem 换算值)。⚠ 实施回填:外壳保持 `top-0`,原「`header.top===48`」判据作废,理由见 §8.1 |
|
||||
| 高度 | `64px`(`--header-height`) | `getBoundingClientRect().height === 64` |
|
||||
| 左右内缩 | 与 `container-x` 的 gutter 对齐(`px-4 / sm:px-6 / lg:px-10` + `max-w-container`) | 1600 视口下左右边界 ≈ 173 / 1427(对标 173…1426) |
|
||||
| 底色/边线 | 保持 `bg-bg-primary` + `border-b border-border-primary` | 守住 Quiet Border Rule(不加装饰阴影,R15) |
|
||||
| 滚动状态 | 新增 `data-header-state="top\|scrolled"` 供 e2e 断言,替代「靠 top 数值猜」 | `chrome-persistence.spec.ts` 从断言 `top===0` 改为 `top===48` —— **这是契约变更,写在提交信息里** |
|
||||
| 动效 | 沿用 `duration-normal`(280ms)+ `--ease-ink`,不新增档位 | `npm run check:motion` EXIT=0 |
|
||||
| 左右内缩 | 与 `container-x` 的 gutter 对齐(`px-4 / sm:px-6 / lg:px-10` + `max-w-container`) | 1600 视口下左右边界 ≈ 173 / 1427(对标 173…1426);实测 **165…1435**(左 −8 / 右 +9,见 §8.2) |
|
||||
| 底色/边线 | `bg-bg-primary` + **四边** `border border-border-primary` | 守住 Quiet Border Rule(不加装饰阴影,R15)。⚠ 实施回填:浮条是独立白条,需要完整四边边界;原全宽外壳的 `border-b` 随外壳去底色一并移除 |
|
||||
| 滚动状态 | 新增 `data-header-state="top\|scrolled"` 供 e2e 断言,替代「靠 top 数值猜」 | 实施回填:`top===0` 契约**未改**(外壳仍贴顶),新增「滚动前后浮条均 top 48 / 高 64」+ `data-header-state="scrolled"` 断言 |
|
||||
| 动效 | 沿用 `duration-normal`(280ms)+ `--ease-ink`,不新增档位 | `npm run check:motion` EXIT=0;实施回填:删除了随滚动的 80→64 高度动画,浮条形状不随滚动变化 |
|
||||
|
||||
**实施顺序(不可颠倒)**:① 加 px 令牌 → ② 改 header 类名与 framer 高度 → ③ 改 `chrome-persistence`
|
||||
断言 → ④ 跑 13 个导航用例 → ⑤ **基线重采(需授权)** → ⑥ 独立只读复跑。
|
||||
@@ -97,9 +98,9 @@ Porsche Consulting 中国站:**白底内缩浮条,x=173…1426 / 高 64 / to
|
||||
|
||||
| 项 | 改判后 |
|
||||
|---|---|
|
||||
| `OPEN-02` | 拆为 **`OPEN-02a`(内缩浮条,未闭,阻塞=基线重采授权)** 与 **`OPEN-02b`(收方汉堡,已判定不做)** |
|
||||
| `AUTH-3` | 从「独立 PR,涉及面最广」细化为「**一次 L3:1 个组件 + 1 条 e2e 契约 + 180 张基线**」 |
|
||||
| 基线预期 | 实施后 180 张失效属预期,不是回归;重采前必须按 §5.57/§5.58 归因 |
|
||||
| `OPEN-02` | 拆为 **`OPEN-02a`(内缩浮条,**已闭 2026-11-27**)** 与 **`OPEN-02b`(收方汉堡,已判定不做)** |
|
||||
| `AUTH-3` | 从「独立 PR,涉及面最广」细化为「**一次 L3:1 个组件 + 1 条 e2e 契约 + 195 张基线**」,已随 `OPEN-02a` 闭合 |
|
||||
| 基线预期 | 实施后失效属预期,不是回归;重采前必须按 §5.57/§5.58 归因。**实测 195 张**(不是预测的 180:页面分母 32 而非 35,另有主题页与元素级截图把 fixed 页头拍入画,见 §8.3) |
|
||||
|
||||
## 6. 翻转条件
|
||||
|
||||
@@ -114,9 +115,67 @@ Porsche Consulting 中国站:**白底内缩浮条,x=173…1426 / 高 64 / to
|
||||
|
||||
## 7. 本 ADR 尚未被门禁覆盖的部分(诚实边界)
|
||||
|
||||
1. **`02a` 的「左右边界 ≈173/1427」没有机器判据** —— 只能人工量一次并写进验收记录。
|
||||
2. **小屏(<md)是否保留内缩未定**:移动端已有全屏抽屉,内缩在小屏可能压掉内容宽度,
|
||||
实施时须实测再定,属实现细节不属本 ADR 范围。
|
||||
3. **`chrome-persistence` 的 `top===0` 断言会随本 ADR 变更** —— 这类「契约随设计变更」的联动
|
||||
没有自动校验,只能靠提交信息写明(本 ADR §4 已要求)。
|
||||
4. **180 张基线的重采未获授权** —— 本 ADR 只定形态,不触发写盘。
|
||||
1. **`02a` 的「左右边界 ≈173/1427」没有机器判据** —— e2e 只断言「内缩 > 0」,精确值靠人工量并写进
|
||||
验收记录(实测 165…1435,见 §8.2)。
|
||||
2. **小屏(<md)是否保留内缩** —— 已实测:390 档保留 16px 内缩(浮条 16…374),未压内容可用性;
|
||||
移动 project 只断言令牌解析值,不做 rect 断言(模拟层的 fixed 量法噪声,见 §8.1)。
|
||||
3. **`chrome-persistence` 的 `top===0` 契约** —— 实施选择了不改契约(外壳仍 `top-0`),
|
||||
新增浮条断言而不是替换旧断言;这条边界因此没有触发。
|
||||
4. **180 张基线的重采未获授权** —— 已于 2026-11-27 获授权并执行(实际 195 张,见 §8.3)。
|
||||
|
||||
## 8. 实施回填(2026-11-27)
|
||||
|
||||
### 8.1 与 §4 的一处偏差:外壳仍 `top-0`
|
||||
|
||||
实施没有把 `top: 48px` 加在 `<header>` 外壳上,而是**外壳固定 `inset-x-0 top-0`、内层用
|
||||
`padding-top: var(--header-inset-top)` 把白条压下来**。两条理由:
|
||||
|
||||
1. `chrome-persistence` 既有的「滚动后 `header.top === 0`」断言守的是**吸顶没有被
|
||||
`page-transition` 的 transform 劫持**(`docs/lessons-learned.md` §5.52),与浮条无关。
|
||||
外壳保持贴顶 ⇒ 这条契约不用改,浮条另加断言即可;若把外壳改成 `top: 48`,
|
||||
该断言要在「动画帧噪声」和「真实位移」之间重新建立基线,收益为零。
|
||||
2. 外壳本身不画底色,48px 顶距必须能透出下面滚动的内容,才形成「浮条」;底色与边线都在
|
||||
内层白条上。
|
||||
|
||||
因此 §4 的判据由「`getComputedStyle(header).top === '48px'`」回填为
|
||||
「内缩层 `paddingTop === '48px'` + 浮条 `rect.top === 48` / `height === 64`」。
|
||||
移动 project 只断言令牌解析值:模拟视口下 `position: fixed` 的 `rect.top` 会随视觉视口
|
||||
漂移(同用例连跑实测 0 / 48 / 139 三个值),这是量法噪声,不是产品缺陷。
|
||||
|
||||
### 8.2 几何读数(dev server,滚动前后一致)
|
||||
|
||||
| 视口宽 | 外壳 top | 浮条 top | 浮条高 | 浮条 x…right |
|
||||
|---|---|---|---|---|
|
||||
| 390 | 0 | 48 | 64 | 16…374 |
|
||||
| 640 | 0 | 48 | 64 | 26…615 |
|
||||
| 768 | 0 | 48 | 64 | 26…743 |
|
||||
| 1024 | 0 | 48 | 64 | 45…979 |
|
||||
| 1280 | 0 | 48 | 64 | 45…1235 |
|
||||
| 1600 | 0 | 48 | 64 | 165…1435 |
|
||||
|
||||
`1600` 档与对标(173…1426)差 8–9px,属 `max-w-container` 与 `px-10` 的既有 gutter 口径,
|
||||
未为 8px 改容器真源。滚动 600px 后浮条 top/高不变,`data-header-state` 切到 `scrolled`。
|
||||
|
||||
### 8.3 基线(§5.57 / §5.58 判据)
|
||||
|
||||
- **预测 180 张不成立,实际 195 张**。构成:32 页 × 5 project 全页 = 160(页面分母是 32,ADR §2.3
|
||||
写的 35 已过期)+ `theme-light/dark-main` 2 × 5 = 10 + `header-navigation` × 5 +
|
||||
页脚 × 5 + 按钮三态 × 4 project = 12 + 产品卡 × 3。后三类是元素级截图里 **fixed 页头压入
|
||||
画面 / 元素盒随页头几何变化**,与浮条同因果,不是无关漂移(旧/新图逐张目视:页脚图上缘的
|
||||
页头覆盖区从 80px 白条变为 48px 透空 + 64px 白条)。
|
||||
- `--update-snapshots=changed` 实写 195 张,`git status --short e2e/visual-snapshots` 恰为 195 行。
|
||||
- 一次 `/solutions/retail`(firefox)首跑失败且未留下错误详情;单独复跑通过并写入基线,
|
||||
随后全量只读复跑同项通过 ⇒ 判为负载下的偶发,不是稳定回归。
|
||||
- **独立只读复跑**:`--update-snapshots=none` ⇒ **225 passed / 0 failed / EXIT=0(最终树 9.0 分钟)**。
|
||||
|
||||
### 8.4 本轮门禁
|
||||
|
||||
| 检查 | 读数 |
|
||||
|---|---|
|
||||
| `npm run type-check` | EXIT=0 |
|
||||
| `npm run lint` | 0 error / **88 warning**(与 HEAD 同) |
|
||||
| `npm run test:unit` | 159 套件 / 1883 例全过 |
|
||||
| `npm run check:grammar` | 21/21 绿 |
|
||||
| `npm run check:motion` | 违规 0 |
|
||||
| `npm run check:a11y` | EXIT=0 |
|
||||
| `chrome-persistence` + `nav-dropdown` + `nav-keyboard` | **52 passed / 8 skipped**(skip 均为既有条件:移动断点不渲染 mega、WebKit 不响应真实 Tab) |
|
||||
@@ -202,3 +202,90 @@ test('能力 mega 面板在 1280x720 下不被裁切,或自身可滚', async (
|
||||
await expect(lastLink).toBeVisible({ timeout: 3000 });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 内缩白浮条(ADR-0012 §4 / `OPEN-02a`)。
|
||||
*
|
||||
* 为什么断言 `getComputedStyle` 而不只读 `getBoundingClientRect`:
|
||||
* 本仓根字号随断点变 16/17/18px,若有人把 `--header-inset-top` 换回 `top-12`(3rem)、
|
||||
* 把高度换回 `h-16`(4rem),类名照样在、type-check 照样过,而实测会变成 48/51/54 与 64/68/72。
|
||||
* computed style 直接读解析后的 px,与视口/滚动无关。
|
||||
*
|
||||
* ⚠ 移动 project(`isMobile: true`)**不做** rect 断言:移动视口模拟下 `position: fixed`
|
||||
* 的 `getBoundingClientRect().top` 会随视觉视口偏移漂移(本轮实测同一用例连跑得到 0 / 48 / 139
|
||||
* 三个值),那是模拟层的量法噪声,不是产品缺陷。桌面 project 才断言「距顶 48 + 左右内缩」。
|
||||
*/
|
||||
test('页头是内缩浮条:padding-top 48px / 高 64px(px 令牌,不是 rem 漂移值)', async ({ page }, testInfo) => {
|
||||
const isMobileProject = testInfo.project.name.includes('mobile');
|
||||
|
||||
await page.goto('/', { waitUntil: 'domcontentloaded' });
|
||||
const wrap = page.locator('header > div').first();
|
||||
const bar = page.getByTestId('header-bar');
|
||||
await expect(bar).toBeVisible({ timeout: 15000 });
|
||||
|
||||
// ① 解析后的 px —— 这条同时钉住「token 被删/被换成 rem 档」两种腐化
|
||||
await expect
|
||||
.poll(() => wrap.evaluate((el) => getComputedStyle(el).paddingTop), { timeout: 15000 })
|
||||
.toBe('48px');
|
||||
await expect
|
||||
.poll(() => bar.evaluate((el) => getComputedStyle(el).height), { timeout: 15000 })
|
||||
.toBe('64px');
|
||||
|
||||
// ② 桌面档:距视口顶 48、自身高 64、左右内缩;滚动后不收起、不位移
|
||||
if (!isMobileProject) {
|
||||
await page.setViewportSize({ width: 1600, height: 900 });
|
||||
|
||||
// ⚠ 必须等入场动画交接(`data-content-ready=1`)后再量:`page-transition.tsx` 的
|
||||
// `will-change: transform` 会劫持 `fixed` 的包含块,此时滚动 600 ⇒ 浮条 top 读到
|
||||
// **48−600 = −552**(本用例首版实测就是这个值)。这与 §5.52 是同一个机理,
|
||||
// 既有两条用例已经在用这个交接标记,这里复用而不是新造锚点。
|
||||
await expect
|
||||
.poll(() => page.evaluate(() => document.documentElement.getAttribute('data-content-ready')), { timeout: 15000 })
|
||||
.toBe('1');
|
||||
expect(
|
||||
await page.evaluate(() => {
|
||||
let n: Element | null = document.querySelector('header');
|
||||
while (n && n !== document.documentElement) {
|
||||
if (getComputedStyle(n).transform !== 'none') return getComputedStyle(n).transform;
|
||||
n = n.parentElement;
|
||||
}
|
||||
return null;
|
||||
}),
|
||||
'祖先链上仍有 transform,此时量 fixed 元素读到的是动画帧',
|
||||
).toBeNull();
|
||||
|
||||
const readBar = () =>
|
||||
bar.evaluate((el) => {
|
||||
const r = el.getBoundingClientRect();
|
||||
return {
|
||||
top: Math.round(r.top),
|
||||
height: Math.round(r.height),
|
||||
left: Math.round(r.left),
|
||||
right: Math.round(r.right),
|
||||
};
|
||||
});
|
||||
|
||||
await expect.poll(async () => (await readBar()).top, { timeout: 15000 }).toBe(48);
|
||||
const top = await readBar();
|
||||
expect(top.top, '浮条顶距必须是 48px').toBe(48);
|
||||
expect(top.height, '浮条高度必须是 64px').toBe(64);
|
||||
expect(top.left, '1600 视口下浮条必须内缩(左边界 > 0)').toBeGreaterThan(0);
|
||||
expect(top.right, '1600 视口下浮条必须内缩(右边界 < 视口宽)').toBeLessThan(1600);
|
||||
|
||||
await page.evaluate(() => {
|
||||
document.documentElement.style.scrollBehavior = 'auto';
|
||||
window.scrollTo(0, 600);
|
||||
});
|
||||
await expect.poll(() => page.evaluate(() => Math.round(window.scrollY)), { timeout: 5000 }).toBe(600);
|
||||
|
||||
const scrolled = await readBar();
|
||||
expect(scrolled.top, '滚动后浮条仍应在 48px').toBe(48);
|
||||
expect(scrolled.height, '滚动后浮条高度不变(02b「收成方汉堡」已判定不做)').toBe(64);
|
||||
await expect(page.locator('header'), '滚动后应切到 scrolled 状态').toHaveAttribute('data-header-state', 'scrolled');
|
||||
|
||||
// 外壳仍贴顶 —— chrome-persistence 既有断言的形态不变
|
||||
await expect
|
||||
.poll(() => page.evaluate(() => Math.round(document.querySelector('header')!.getBoundingClientRect().top)), { timeout: 5000 })
|
||||
.toBe(0);
|
||||
}
|
||||
});
|
||||
|
Before Width: | Height: | Size: 731 KiB After Width: | Height: | Size: 731 KiB |
|
Before Width: | Height: | Size: 550 KiB After Width: | Height: | Size: 551 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1005 B After Width: | Height: | Size: 1014 B |
|
Before Width: | Height: | Size: 346 KiB After Width: | Height: | Size: 346 KiB |
|
Before Width: | Height: | Size: 335 KiB After Width: | Height: | Size: 336 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 325 KiB After Width: | Height: | Size: 326 KiB |
|
Before Width: | Height: | Size: 496 KiB After Width: | Height: | Size: 494 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 552 KiB After Width: | Height: | Size: 552 KiB |
|
Before Width: | Height: | Size: 591 KiB After Width: | Height: | Size: 592 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 604 KiB After Width: | Height: | Size: 605 KiB |
|
Before Width: | Height: | Size: 629 KiB After Width: | Height: | Size: 629 KiB |
|
Before Width: | Height: | Size: 626 KiB After Width: | Height: | Size: 625 KiB |
|
Before Width: | Height: | Size: 728 KiB After Width: | Height: | Size: 729 KiB |
|
Before Width: | Height: | Size: 542 KiB After Width: | Height: | Size: 543 KiB |
|
Before Width: | Height: | Size: 688 KiB After Width: | Height: | Size: 688 KiB |
|
Before Width: | Height: | Size: 697 KiB After Width: | Height: | Size: 698 KiB |
|
Before Width: | Height: | Size: 752 KiB After Width: | Height: | Size: 753 KiB |
|
Before Width: | Height: | Size: 609 KiB After Width: | Height: | Size: 610 KiB |
|
Before Width: | Height: | Size: 592 KiB After Width: | Height: | Size: 593 KiB |
|
Before Width: | Height: | Size: 595 KiB After Width: | Height: | Size: 595 KiB |
|
Before Width: | Height: | Size: 588 KiB After Width: | Height: | Size: 588 KiB |
|
Before Width: | Height: | Size: 650 KiB After Width: | Height: | Size: 650 KiB |
|
Before Width: | Height: | Size: 768 KiB After Width: | Height: | Size: 768 KiB |
|
Before Width: | Height: | Size: 790 KiB After Width: | Height: | Size: 790 KiB |
|
Before Width: | Height: | Size: 771 KiB After Width: | Height: | Size: 772 KiB |
|
Before Width: | Height: | Size: 781 KiB After Width: | Height: | Size: 782 KiB |
|
Before Width: | Height: | Size: 788 KiB After Width: | Height: | Size: 787 KiB |
|
Before Width: | Height: | Size: 790 KiB After Width: | Height: | Size: 790 KiB |
|
Before Width: | Height: | Size: 522 KiB After Width: | Height: | Size: 523 KiB |
|
Before Width: | Height: | Size: 623 KiB After Width: | Height: | Size: 624 KiB |
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 2.3 MiB After Width: | Height: | Size: 2.3 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 608 KiB After Width: | Height: | Size: 605 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 12 MiB After Width: | Height: | Size: 12 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 3.0 MiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 12 MiB After Width: | Height: | Size: 12 MiB |
|
Before Width: | Height: | Size: 12 MiB After Width: | Height: | Size: 12 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 932 KiB After Width: | Height: | Size: 935 KiB |
|
Before Width: | Height: | Size: 939 KiB After Width: | Height: | Size: 942 KiB |
|
Before Width: | Height: | Size: 435 KiB After Width: | Height: | Size: 441 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 6.0 MiB After Width: | Height: | Size: 6.0 MiB |
|
Before Width: | Height: | Size: 847 KiB After Width: | Height: | Size: 852 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |