From 28bb5800ea7a0ccb28fafe1cc5f4b892781e93ff Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Fri, 11 Sep 2026 11:28:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=80=BB=E8=A7=88=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E5=A4=A7=E6=A0=87=E9=A2=98=E6=97=81=E7=9A=84=E5=89=AF?= =?UTF-8?q?=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除资源总览标题栏里那颗副标题的**两个分支**:`${canvasResources.length} 项正式与候选资源` 与空项目时的 `从资源栏目开始整理资源` - 位置:`apps/ai-game-creator-shell/src/view/project-development/index.tsx` 的 `
`(基线 364492de3 的 5867-5871 行那颗 ``,标题栏自 5863 行起) - 同步删除只服务于它的 `.game-resource-book-main-heading > span` 样式,模块内不再留墓碑规则 - 该文案没有承载 `aria-label` 等语义(区域语义一直在容器的 `aria-label="资源总览"` 上),因此不需要把语义迁移到容器,也没有改成"更短的说明" - 全量计数没有丢:同一次改动后由总览第 0 张「所有资源」卡的计数徽标承载,仍是同一份画布投影 - 卡片内部的说明/装饰文案(「打开 UI 交互」「打开角色与对象」「1 个直接子版本」等)保持不动 - 断言:资源总览标题栏整段 `textContent` 恰为「资源总览」(精确相等,不放宽成 `not.toContain`),并复核总览第 0 张卡与「文档」栏目卡的内部文案仍在 - 既有用例没有任何一条断言过这段副标题文案(全仓检索只命中源文件),因此没有"按文案已删更新"或"按四不写删除"的对象;本用例是补上的正向合同断言 --- apps/ai-game-creator-shell/src/styles.css | 5 - .../src/view/project-development/index.tsx | 9 +- .../appSurface/project-development.suite.ts | 92 +++++++++++++++++++ 3 files changed, 93 insertions(+), 13 deletions(-) diff --git a/apps/ai-game-creator-shell/src/styles.css b/apps/ai-game-creator-shell/src/styles.css index 18b025651..76d00c806 100644 --- a/apps/ai-game-creator-shell/src/styles.css +++ b/apps/ai-game-creator-shell/src/styles.css @@ -5893,11 +5893,6 @@ iframe.preview-frame { line-height: 1.1; } -.game-resource-book-main-heading > span { - color: #a4877a; - font-size: 12px; -} - .game-resource-book-main-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); diff --git a/apps/ai-game-creator-shell/src/view/project-development/index.tsx b/apps/ai-game-creator-shell/src/view/project-development/index.tsx index e5ea3cdca..1fcda0ed4 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/index.tsx +++ b/apps/ai-game-creator-shell/src/view/project-development/index.tsx @@ -6105,14 +6105,7 @@ export default function ProjectDevelopmentView({ } >
-
-

资源总览

-
- - {canvasResources.length > 0 - ? `${canvasResources.length} 项正式与候选资源` - : '从资源栏目开始整理资源'} - +

资源总览

{ + const manifest = createGameCreationAppManifest( + 'workbench-overview-heading', + '总览标题项目', + ); + manifest.assets = [ + { + id: 'overview-heading-document', + kind: 'design-document', + mediaType: 'text/markdown', + localPath: 'memory/overview-heading.md', + source: { kind: 'generated', taskId: 'design-foundation' }, + category: 'document', + }, + ]; + window.__TAURI__ = { + core: { + invoke: vi.fn( + async (command: string, args?: Record) => { + if (command === 'read_local_project_resource_graph') { + return resourceGraphForInputs(args); + } + if (command === 'read_local_project_resource_canvas_layout') { + return { + schemaVersion: 'game-creator-resource-layout.v1', + projectId: args?.expectedProjectId, + mode: args?.mode, + revision: 0, + positions: [], + updatedAt: 0, + }; + } + if (command === 'update_local_project_resource_canvas_layout') { + return { + status: 'updated', + layout: { + schemaVersion: 'game-creator-resource-layout.v1', + projectId: args?.expectedProjectId, + mode: args?.mode, + revision: 1, + positions: args?.positions, + updatedAt: 1, + }, + }; + } + throw new Error(`unexpected invoke ${command}`); + }, + ), + }, + }; + + render( + React.createElement(ProjectDevelopmentView, { + projectName: manifest.name, + projectPath: '/tmp/workbench-overview-heading', + manifest, + attachments: [], + recentRunStatus: null, + recentRunStopReason: null, + supervisor: React.createElement('div', null, '项目总控'), + onHomeOpen: vi.fn(), + onProjectsOpen: vi.fn(), + }), + ); + + const heading = await waitFor(() => { + const element = document.querySelector( + '.game-resource-book-main-heading', + ); + expect(element).not.toBeNull(); + return element!; + }); + // 精确到标题栏整段文本:副标题只要回来一个字,这条断言就会红。 + expect(heading.textContent).toBe('资源总览'); + expect(heading.querySelectorAll('h2')).toHaveLength(1); + expect(heading.querySelector('h2')?.textContent).toBe('资源总览'); + // 卡片里的装饰性文案必须原样保留(同一次改动里最容易误删的东西)。 + expect(screen.getByRole('button', { name: '打开所有资源' })).not.toBeNull(); + expect( + document.querySelector( + '.game-resource-book-thumbnail[data-resource-book-category="document"] .game-resource-book-thumbnail-footer', + )?.textContent, + ).toContain('打开文档'); + }); }