Files
Jyotisha/frontend/tests/starter-entry-soften.test.ts
T
jesse-uxandGrok (agent loop) d25dfdbe1a
Independent Staging Quality Gate / validate (push) Failing after 9m13s
Independent Staging Quality Gate / publish (push) Skipped
对话页换成组件库,桌面旁边可以打开本命盘(#106)。
输入框里左边选模型、右边发送。回答下的赞、踩、复制、重新生成和追问改用组件库按钮。不满意原因和兑换窗改用对话框,句子不变。桌面顶栏可以打开当前人物的本命盘,能拖宽,刷新后还在;手机没有这个入口。当前会话和流式状态从 Home() 移进已有会话 store,useState 从 33 减到 25。流式、停止、排队、撤回、退点和寒暄免费没有改。

自测:tsc 退出码 0;lint 0 error、122 条警告;定向测试 275 通过、失败 0、取消 0;npm run build 退出码 0,/ 仍是 Static。首屏 gzip-9 639127,相对基线 634528 多 0.72%。隐私标记测试退出码 0。

Co-Authored-By: Grok (agent loop)
2026-10-25 03:15:13 +08:00

47 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 starterHome = readFileSync(new URL("../src/components/starter-home.tsx", import.meta.url), "utf8");
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
const design = readFileSync(new URL("../DESIGN.md", import.meta.url), "utf8");
function starterEntryBlock(): string {
const start = css.indexOf(".starter-entry {");
const end = css.indexOf(".starter-entry > svg");
assert.ok(start >= 0 && end > start);
return css.slice(start, end);
}
test("starter entries stay a 36px pill with a 44px hit area", () => {
// 原值:`<button className="starter-entry"`
// 新值:`<Button className="starter-entry"`
// 原因:K2 今日星语改用组件库 Button,36px 胶囊和 44px 点按区仍由 `.starter-entry` 决定
assert.match(starterHome, /<Button[\s\S]*className="starter-entry"/);
// 原值: 2 新值: 1(生时校正 pill 删除) 原因: BUG-1247(TASK-rectification-in-chat-step1-20261006 P3/C1):首页生时校正按钮与文字口令删除,校正只从对话里的提议卡进入
assert.equal(starterHome.match(/className="starter-entry"/g)?.length, 1);
assert.doesNotMatch(starterHome, /starter-hero|product-entrypoint|daily-starlanguage-card|birth-rectification-card/);
assert.doesNotMatch(starterHome, /正在加载|InlineSpinner|animate-spin/);
const block = starterEntryBlock();
assert.match(block, /min-height:\s*36px/);
assert.match(block, /--starter-entry-border:\s*color-mix\(in srgb, var\(--color-border\) 62%, transparent\)/);
assert.match(block, /border:\s*1px solid var\(--starter-entry-border\)/);
assert.doesNotMatch(block, /border:\s*1px solid var\(--color-border-strong\)/);
assert.match(css, /\.starter-entry::after\s*\{[^}]*inset:\s*-4px/);
});
test("starter entry hover stays softer than the action color and focus is a 3px ring", () => {
const hover = css.slice(css.indexOf(".starter-entry:not(:disabled):hover"), css.indexOf(".starter-entry:focus-visible"));
assert.match(hover, /color-mix\(in srgb, var\(--color-border-strong\) 45%, var\(--color-border\)\)/);
assert.doesNotMatch(hover, /border-color:\s*var\(--color-action\)/);
assert.match(css, /\.starter-entry:focus-visible\s*\{[^}]*outline:\s*3px solid color-mix\(in srgb, var\(--color-focus\) 80%, transparent\)/);
assert.match(css, /\.starter-entry\[data-opening="true"\]\s*\{\s*cursor:\s*progress/);
// 原值:入口行 max-width: 100% 位于 max-width: 375px 媒体块。
// 新值:同一防溢出规则位于既有 max-width: 480px 媒体块。
// 原因:BUG-1012 按 BUG-697 收敛断点,不扩白名单;按钮尺寸、焦点与防溢出要求不变。
assert.match(css, /@media \(max-width:\s*480px\)\s*\{[^}]*\.starter-entry-row\s*\{\s*max-width:\s*100%/);
assert.match(css, /@media \(prefers-reduced-motion:\s*reduce\)[\s\S]*transition-duration:\s*\.01ms !important/);
assert.match(design, /--starter-entry-border/);
assert.match(design, /inset: -4px/);
});