Files
Jyotisha/frontend/tests/profile-panel.test.ts
T
ClaudeandClaude Fable 5.2 5e2defe196 feat(settings): rows, neutral selected states, three-page 账户与点数, own avatar picture (BUG-2059)
Owner-approved prototype of 2026-11-20.

- Dialog: selected states are the sidebar's neutral fill with bold ink
  (pane menu, theme choice, ledger filter, palette ring); no accent fill
  and no bar on the left. 880 x 640 kept.
- 个人资料 / 通用设置: one setting per row, the name left and the control
  right, under small group titles.
- 账户与点数: the balance is drawn by the page (not the lazy panel), then
  one full-width line of tabs and three pages: 兑换码 (default), 点数记录,
  and 充值 only while the admin switch has top-up open. Every hint and
  rule line is gone; membership has no page while it has no content.
  Rows still being read are bars of the real height; empty and failed
  states are one line, failed with 再试一次. Results are toasts.
- Own avatar picture: the 头像 row opens 上传图片 / 移除 (a bottom sheet on
  a phone), a round crop with zoom, drawn at 256 x 256 and compressed to
  about 60 KB in the browser; a source over 5 MB is refused when chosen.
  With a picture the 形象 and 配色 rows are put away. The sidebar corner
  and the account menu show the same picture.

Built on BUG-2057 (routes, switch, ledger, avatar storage) and BUG-2056
(results as toasts). Pinned tests updated with before / after / reason.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-20 10:48:29 +08:00

26 lines
1.8 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 panel = readFileSync(new URL("../src/components/profile-panel.tsx", import.meta.url), "utf8");
test("the profile pane keeps avatar palettes and drops the duplicate chart-library button", () => {
assert.doesNotMatch(panel, /管理星盘资料/);
assert.match(panel, /role="radiogroup"/);
assert.match(panel, /换一个形象/);
// 原值:48px;新值:56px;原因:设置面板的头像预览需要更清晰的视觉锚点,并与账户身份区留出稳定间距。
// 原值:`size={56}`。
// 新值:桌面预览 `size={64}`(手机由样式压到 56px);八个配色色块里各画一个 32px 的同一头像。
// 原因:2026-11-03 设置弹窗改版原型(产品已批准):头像 64px 与「换一个形象」同一行,色块是真实预览。
// 原值:`size={64}`,头像和「换一个形象」同一行。
// 新值:「头像」一行右侧是 44px 的头像(可点,见 avatar-image-row.tsx);「形象」「配色」各自一行。
// 原因:BUG-2059,负责人 2026-11-20 批准的设置原型:每个设置项一行,左边名称、右边控件。
assert.match(panel, /<UserAvatar avatar=\{avatar\} imageVersion=\{imageVersion\} size=\{44\} label="当前头像预览" \/>/);
// 原值:配色格里是 <UserAvatar avatar={{ ...avatar, palette: index }} size={32} />
// 新值:配色格里画这套配色本身(paletteFill(palette.colors))
// 原因:同一个 seed 的脸在八套配色里都是浅色,预览分不出配色(2026-11-03 设置改版复查)
assert.match(panel, /className="avatar-palette-colors" style=\{\{ background: paletteFill\(palette\.colors\) \}\}/);
assert.match(panel, /账户信息/);
assert.match(panel, /登录邮箱/);
});