fix(web): 管理价格与创作空态 - 合并 PR #373 并保留 create 路由

This commit is contained in:
ddCat committed 2026-09-01 19:12:10 +08:00
commit b8c500cb40
6 files changed
+69 -17

No files matched your search

+4 -1
View File
@@ -45,7 +45,10 @@ test("analytics keeps fixed range presets distinct and uses enabled channel mode
expect(source).toContain("onChange={handlePricingModelChange}");
expect(source).toContain('hasOwnProperty.call(changedValues, "model")');
expect(source).toContain('if (matchingChannels.length) form.setFieldValue("channelId", matchingChannels[0].id)');
expect(source).toContain("const sourceChannels = channels.filter((channel) => channel.enabled !== false)");
expect(source).toContain("const sourceChannels = channels.filter(");
expect(source).toContain('Form.useWatch("channelId", form)');
expect(source).toContain("pricingChannelId");
expect(source).toContain("channel.id === pricingChannelId");
expect(source).toContain('inputMode="decimal"');
expect(source).toContain('className="admin-analytics-price-input"');
expect(source).toContain('className="admin-analytics-price-field"');
+18
View File
@@ -0,0 +1,18 @@
import { expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
test("create empty state keeps the banner and composer in document flow", () => {
const styles = readFileSync(resolve(import.meta.dir, "../src/styles/globals.css"), "utf8");
const layoutStart = styles.indexOf("/* 空态布局收敛:保持图片区、文案和输入区的文档流顺序");
const layoutEnd = styles.indexOf("/* ===== 素材库", layoutStart);
const layout = styles.slice(layoutStart, layoutEnd);
expect(layoutStart).toBeGreaterThanOrEqual(0);
expect(layoutEnd).toBeGreaterThan(layoutStart);
expect(layout).toContain("justify-content: flex-start;");
expect(layout).toContain("flex: 0 0 auto;");
expect(layout).toContain("margin: 0 auto 20px;");
expect(layout).not.toContain("margin: auto auto 20px;");
expect(layout).not.toContain("margin: 26px auto auto;");
});
+2 -2
View File
@@ -29,12 +29,12 @@ describe("workspace route loading", () => {
expect(navigation).toContain("onFocus={() => preloadWorkspaceRoute(linkTo)}");
});
test("uses the creation page as the root entry without legacy home or create routes", () => {
test("keeps the creation page at root and preserves the create compatibility route", () => {
const router = source("../src/router.tsx");
const navigation = source("../src/components/layout/workspace-sidebar-nav.tsx");
expect(router).toContain('{ path: "/", element: <RequireAuth>{deferred(<CreatePage />)}</RequireAuth> }');
expect(router).not.toContain('path: "/create"');
expect(router).toContain('{ path: "/create", element: <RequireAuth>{deferred(<CreatePage />)}</RequireAuth> }');
expect(router).not.toContain('path: "/home"');
expect(router).not.toContain("HomePage");
expect(navigation).toContain('{ id: "home", title: "首页", icon: Home, to: "/" }');