fix(*): 请求明细与画布主题 - 区分非计费下载日志并更新默认网格配色

This commit is contained in:
ddCat committed 2026-09-01 23:54:41 +08:00
1 parent 1bbccaedc4
commit 58272e683f
14 files changed
+81 -47

No files matched your search

+6
View File
@@ -192,9 +192,15 @@ test("request logs display user credit billing independently from upstream cost"
const billingSummary = sourceSection(listSource, "function BillingSummary", "function MediaResult");
expect(listSource).toContain('title: "积分计费"');
expect(listSource).toContain('title: "请求阶段 / 状态"');
expect(listSource).toContain('description="模型生成、状态查询与结果下载;仅计费调用扣除积分"');
expect(billingSummary).toContain("billingAmountMicrocredits");
expect(billingSummary).toContain("billingAvailable");
expect(billingSummary).toContain("!log.billable");
expect(billingSummary).toContain("不计费");
expect(billingSummary).not.toContain("costAvailable");
expect(detailSource).toContain('["请求阶段", requestKindText(log.requestKind)]');
expect(detailSource).toContain('["计费属性", log.billable ? "计费调用" : "不计费"]');
expect(detailSource).toContain('["积分计费", billingText(log)]');
expect(detailSource).toContain('["上游成本", log.costAvailable');
expect(apiSource).toContain("billingAmountMicrocredits: number");
+12 -5
View File
@@ -1,6 +1,7 @@
import { beforeEach, describe, expect, test } from "bun:test";
import {
DEFAULT_CANVAS_BACKGROUND_MODE,
canvasAppearanceForTheme,
customCanvasAppearanceFromTheme,
enterCustomCanvasAppearance,
@@ -29,21 +30,25 @@ beforeEach(() => {
});
describe("canvas custom appearance", () => {
test("uses point grid as the default for new canvases", () => {
expect(DEFAULT_CANVAS_BACKGROUND_MODE).toBe("dots");
});
test("inherits the active fixed theme the first time custom mode is selected", () => {
const light = enterCustomCanvasAppearance(canvasAppearanceForTheme("light"), "light");
expect(light).toEqual({
mode: "custom",
custom: {
baseTheme: "light",
backgroundColor: "#EDEEEE",
backgroundColor: "#F0F0F0",
backgroundBrightness: 0,
gridColor: "#B6B3B3",
gridOpacity: 70,
gridColor: "#000000",
gridOpacity: 80,
},
});
const dark = enterCustomCanvasAppearance(canvasAppearanceForTheme("dark"), "dark");
expect(dark.custom).toMatchObject({ baseTheme: "dark", backgroundColor: "#262626", backgroundBrightness: 0, gridColor: "#B6B3B3", gridOpacity: 70 });
expect(dark.custom).toMatchObject({ baseTheme: "dark", backgroundColor: "#000000", backgroundBrightness: 0, gridColor: "#AFAFAF", gridOpacity: 80 });
});
test("restores a previous custom profile only under the same base theme", () => {
@@ -56,7 +61,7 @@ describe("canvas custom appearance", () => {
expect(fixedDark.custom).toBeUndefined();
expect(enterCustomCanvasAppearance(fixedDark, "dark").custom).toMatchObject({
baseTheme: "dark",
backgroundColor: "#262626",
backgroundColor: "#000000",
});
});
@@ -136,6 +141,8 @@ describe("canvas custom appearance", () => {
test("does not expose background opacity after legacy values are ignored", async () => {
const controlsSource = await Bun.file(new URL("../src/components/canvas/canvas-appearance-controls.tsx", import.meta.url)).text();
expect(controlsSource).toContain('const LIGHT_PRESETS = ["#F0F0F0"');
expect(controlsSource).toContain('const DARK_PRESETS = ["#000000"');
expect(controlsSource).not.toContain('label="背景透明度"');
expect(controlsSource).toContain('aria-label="界面样式"');
expect(controlsSource).toContain('label="网格强度"');
+6 -6
View File
@@ -11,7 +11,7 @@ describe("canvas visual contrast", () => {
});
test("changes only the canvas substrate while retaining original surfaces", () => {
expect(canvasThemes.light.canvas.background).toBe("#edeeee");
expect(canvasThemes.light.canvas.background).toBe("#f0f0f0");
expect(canvasThemes.light.node.fill).toBe("#ffffff");
expect(canvasThemes.light.node.edge).toBe("rgba(15,23,42,.16)");
expect(canvasThemes.light.node.shadow).toBe("0 6px 18px rgba(15,23,42,.08)");
@@ -19,7 +19,7 @@ describe("canvas visual contrast", () => {
expect(canvasThemes.light.toolbar.panel).toBe("rgba(255,255,255,.94)");
expect(canvasThemes.light.spatial.elevated).toBe("rgba(255,255,255,.94)");
expect(canvasThemes.dark.canvas.background).toBe("#262626");
expect(canvasThemes.dark.canvas.background).toBe("#000000");
expect(canvasThemes.dark.node.fill).toBe("#181818");
expect(canvasThemes.dark.node.edge).toBe("rgba(255,255,255,.18)");
expect(canvasThemes.dark.node.shadow).toBe("0 8px 24px rgba(0,0,0,.34)");
@@ -30,10 +30,10 @@ describe("canvas visual contrast", () => {
});
test("pins intentional grid tokens while retaining canvas grid opacity", async () => {
expect(canvasThemes.light.canvas.dot).toBe("rgba(15,23,42,.20)");
expect(canvasThemes.light.canvas.line).toBe("rgba(15,23,42,.15)");
expect(canvasThemes.dark.canvas.dot).toBe("rgba(205,205,205,.28)");
expect(canvasThemes.dark.canvas.line).toBe("rgba(205,205,205,.28)");
expect(canvasThemes.light.canvas.dot).toBe("rgba(0,0,0,.80)");
expect(canvasThemes.light.canvas.line).toBe("rgba(0,0,0,.80)");
expect(canvasThemes.dark.canvas.dot).toBe("rgba(175,175,175,.80)");
expect(canvasThemes.dark.canvas.line).toBe("rgba(175,175,175,.80)");
const source = await Bun.file(new URL("../src/components/canvas/infinite-canvas.tsx", import.meta.url)).text();
expect(source).toContain('opacity: mode === "dots" ? 0.34 : 0.46');