Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
40 lines
3.0 KiB
TypeScript
40 lines
3.0 KiB
TypeScript
import assert from "node:assert/strict";
|
||
import { readFileSync } from "node:fs";
|
||
import test from "node:test";
|
||
|
||
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
|
||
const layout = readFileSync(new URL("../src/app/layout.tsx", import.meta.url), "utf8");
|
||
|
||
test("mobile login can scroll and keeps the form reachable on a short screen", () => {
|
||
// BUG-698: the full-viewport height is now a vh base upgraded inside
|
||
// @supports (height: 1dvh). Same shipped behaviour on every engine that knows dvh,
|
||
// and a real height on the engines that do not.
|
||
// 原值:手机断点里 `.auth-page { height: 100vh; overflow-x: hidden; overflow-y: auto; … }`,
|
||
// 另在手机 @supports 里升级到 100dvh;`.auth-shell { min-height: 100%; overflow: visible; … }`;
|
||
// 矮屏(≤640px 高)藏起左栏 `.auth-story`
|
||
// 新值:登录页的 <main> 本来就是 `.standalone-page`(所有宽度 100vh、overflow: auto,@supports 里 100dvh),
|
||
// 手机断点只补 `overflow-x: hidden` 和左右安全区;没有卡片和左栏,内容按行排、整页滚动
|
||
// 原因:BUG-2139 第二步按方向 A 改版(负责人 2026-11-22):单栏居中,`.auth-shell` / `.auth-story` 已删除
|
||
const login = readFileSync(new URL("../src/components/email-otp-login.tsx", import.meta.url), "utf8");
|
||
assert.match(login, /<main className="standalone-page auth-page">/);
|
||
assert.match(css, /\.standalone-page \{ width: 100%; height: 100vh; overflow: auto; \}/);
|
||
assert.match(css, /@supports \(height: 1dvh\) \{[^}]*\.standalone-page \{ height: 100dvh; \}/);
|
||
assert.match(css, /@media \(max-width: 767px\) \{[\s\S]*?\.auth-page \{ overflow-x: hidden; -webkit-overflow-scrolling: touch;/);
|
||
// 原值:`.auth-page { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; …`
|
||
// 新值:`.auth-page { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; …`
|
||
// 原因:BUG-2236,iPhone 上隐式 auto 列按标题一行的宽度撑开,整列比屏幕宽;列宽改为跟页面走
|
||
assert.match(css, /\.auth-page \{ display: grid; grid-template-columns: minmax\(0, 1fr\); grid-template-rows: auto minmax\(0, 1fr\) auto;/);
|
||
assert.doesNotMatch(css, /\.auth-shell|\.auth-story/);
|
||
assert.match(layout, /interactiveWidget:\s*"resizes-content"/);
|
||
});
|
||
|
||
test("mobile onboarding does not clip the birth place levels or session history", () => {
|
||
assert.match(css, /\.session-nav \{ overflow: visible; \}/);
|
||
assert.doesNotMatch(css, /\.session-nav \{ overflow: hidden; \}/);
|
||
// The birth place levels portal their popup out of the onboarding card, so an
|
||
// ancestor can no longer clip it and only the viewport height still constrains it.
|
||
const select = readFileSync(new URL("../src/components/ui/select.tsx", import.meta.url), "utf8");
|
||
assert.match(select, /<SelectPrimitive\.Portal>/);
|
||
assert.match(css, /\.select-list \{ max-height: min\(288px, 48dvh\) !important; \}/);
|
||
});
|