Files
Jyotisha/frontend/tests/mobile-interaction-contract.test.ts
T
ClaudeandClaude Opus 5.5 19fe804ba5
Independent Staging Quality Gate / validate-python (push) Successful in 10m40s
Independent Staging Quality Gate / validate-frontend (push) Successful in 14m25s
Independent Staging Quality Gate / publish (push) Successful in 3m0s
fix(login): the login column follows the page width so the headline wraps on iPhones (BUG-2236)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-23 09:07:39 +08:00

40 lines
3.0 KiB
TypeScript
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.
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; \}/);
});