feat(*): 模型编辑与画布 - 统一编辑弹窗并稳定网格和后台切页
This commit is contained in:
1 parent
bf0c4454fa
commit
83ce57e65f
23 files changed
+1749
-1678
No files matched your search
@@ -34,10 +34,7 @@ test("announcement editor preserves image and pinned fields through edit and sav
|
||||
});
|
||||
|
||||
test("plugin upload owns native drops and price availability text remains readable", async () => {
|
||||
const [pluginSource, adminCss] = await Promise.all([
|
||||
Bun.file(new URL("../src/pages/plugins/plugin-documentation-modals.tsx", import.meta.url)).text(),
|
||||
Bun.file(new URL("../src/styles/admin-ui.css", import.meta.url)).text(),
|
||||
]);
|
||||
const [pluginSource, adminCss] = await Promise.all([Bun.file(new URL("../src/pages/plugins/plugin-documentation-modals.tsx", import.meta.url)).text(), Bun.file(new URL("../src/styles/admin-ui.css", import.meta.url)).text()]);
|
||||
const toggleCss = sourceSection(adminCss, ".admin-price-tier-toggle span {", ".admin-model-editor-add-tier.ant-btn {");
|
||||
|
||||
expect(pluginSource).toContain("event.preventDefault()");
|
||||
@@ -46,12 +43,36 @@ test("plugin upload owns native drops and price availability text remains readab
|
||||
expect(pluginSource).toContain("点击选择插件文件,也可拖拽到此处");
|
||||
expect(pluginSource).toContain("释放文件以上传插件");
|
||||
expect(pluginSource).toContain("isDraggingPlugin");
|
||||
expect(compactSource(adminCss)).toContain(".admin-price-tier-controls { display: grid !important; grid-template-columns: minmax(0, 1fr);");
|
||||
expect(compactSource(adminCss)).toContain(".admin-price-tier-controls { margin-left: auto;");
|
||||
expect(toggleCss).toContain("overflow-wrap: anywhere;");
|
||||
expect(toggleCss).toContain("white-space: normal;");
|
||||
expect(toggleCss).not.toContain("text-overflow: ellipsis;");
|
||||
});
|
||||
|
||||
test("model reference limits use compact rows only inside the admin editor", async () => {
|
||||
const css = await Bun.file(new URL("../src/styles/admin-ui.css", import.meta.url)).text();
|
||||
const numberField = sourceSection(css, ".admin-model-editor-references .admin-capability-number-field {", ".admin-model-editor-references .admin-capability-boolean-field {");
|
||||
expect(numberField).toContain("grid-template-columns: minmax(0, 1fr) 80px;");
|
||||
expect(numberField).toContain("min-height: 32px;");
|
||||
expect(numberField).toContain("align-items: center;");
|
||||
const switches = sourceSection(css, ".admin-model-editor-references .admin-capability-boolean-field label {", "@media (min-width: 601px)");
|
||||
expect(switches).toContain("display: flex;");
|
||||
expect(compactSource(css)).toContain(".admin-model-editor-references .admin-capability-reference-grid { align-items: start;");
|
||||
expect(compactSource(css)).toContain(".admin-model-editor-modal .admin-capability-reference-grid { grid-template-columns: minmax(0, 1fr);");
|
||||
});
|
||||
|
||||
test("model editor presents protocols in a searchable inline radio browser instead of a dropdown", async () => {
|
||||
const [source, css] = await Promise.all([
|
||||
Bun.file(new URL("../src/pages/admin/components/channel-model-editor.tsx", import.meta.url)).text(),
|
||||
Bun.file(new URL("../src/styles/admin-ui.css", import.meta.url)).text(),
|
||||
]);
|
||||
const protocolSection = sourceSection(source, '<Form.Item\n className="admin-model-protocol-field"', "{protocolError && (");
|
||||
|
||||
expect(protocolSection).toContain("<ModelProtocolBrowser");
|
||||
expect(protocolSection).not.toContain("<Select");
|
||||
expect(compactSource(css)).toContain(".admin-model-protocol-field { grid-column: 1 / -1;");
|
||||
});
|
||||
|
||||
test("channel model fetch requires explicit selection before import", async () => {
|
||||
const [componentSource, apiSource, adminCssSource] = await Promise.all([
|
||||
Bun.file(new URL("../src/pages/admin/components/channel-model-manager.tsx", import.meta.url)).text(),
|
||||
@@ -60,8 +81,8 @@ test("channel model fetch requires explicit selection before import", async () =
|
||||
]);
|
||||
const component = compactSource(componentSource);
|
||||
|
||||
expect(apiSource).toContain('api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/fetch`)');
|
||||
expect(apiSource).toContain('api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/import`, { models })');
|
||||
expect(apiSource).toContain("api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/fetch`)");
|
||||
expect(apiSource).toContain("api.post(`/admin/channels/${encodeURIComponent(channelId)}/models/import`, { models })");
|
||||
expect(component).toContain('title="选择要导入的模型"');
|
||||
expect(component).toContain("默认已全选");
|
||||
expect(component).toContain("setFetchPreviewOpen(true)");
|
||||
|
||||
Reference in new issue
Block a user