fix(create): 修复创作页布局与模型价格筛选

This commit is contained in:
Rou
2026-09-01 17:51:18 +08:00
parent 70d272853e
commit 667e144e7a
4 changed files with 48 additions and 10 deletions

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"');

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;");
});