「整理画布」移入资源动作簇:排在「生成素材」之后,不再挂在这一行行尾

- index.tsx:把「整理画布」从 game-workbench-view-actions 行尾(排序 tab 之后)
  移到「生成素材」之后、「管理未完成编辑」之前,与其它资源动作同类相邻,
  标签仍为 aria-label=\"整理画布\",零 CSS 改动
- index.tsx:语义与行为一字未改——disabled={!resourceLayoutReady}、
  aria-busy={resourceLayoutSaving}、onClick 仍调 activeResourceLayout.rederiveNow(),
  反馈仍走既有 resourceLayoutNotice / resourceLayoutSaving,changed 门保留
- resourceCanvasManualLayout.test.tsx:位置断言改为钉新位置——该行最后一个按钮不是它、
  它在「生成素材」之后(previousElementSibling)、在排序组左侧;
  继续保留「资源排列方式」组内只有「按依赖 / 按类型」与本按钮不在该组 /
  不在 .game-resource-sort-tabs 内的断言
This commit is contained in:
2026-09-14 19:25:21 +08:00
parent 21c85c4dd1
commit 417b5ec630
2 changed files with 41 additions and 25 deletions
@@ -7152,6 +7152,27 @@ export default function ProjectDevelopmentView({
</button>
) : null}
{/*
`game-workbench-view-actions`
+ secondary pill
CSS****"针对整个工具条"
/
/
*/}
<button
type="button"
aria-label="整理画布"
disabled={!resourceLayoutReady}
aria-busy={resourceLayoutSaving}
onClick={() => activeResourceLayout.rederiveNow()}
>
<LayoutGrid size={15} aria-hidden="true" />
</button>
{pendingResourceEdits.length > 0 ||
pendingResourceEditsLoadState === 'failed' ? (
<button
@@ -7199,26 +7220,6 @@ export default function ProjectDevelopmentView({
</button>
</div>
{/*
`game-workbench-view-actions`
+ secondary pill
CSS
/
/
*/}
<button
type="button"
aria-label="整理画布"
disabled={!resourceLayoutReady}
aria-busy={resourceLayoutSaving}
onClick={() => activeResourceLayout.rederiveNow()}
>
<LayoutGrid size={15} aria-hidden="true" />
</button>
</>
) : null}
</div>
@@ -753,7 +753,7 @@ describe('资源画布手动重排口径', () => {
expect(typeWrites(tauri)).toHaveLength(1);
});
it('「整理画布」不属于「资源排列方式」这组模式切换,而是一枚独立动作按钮', async () => {
it('「整理画布」不属于「资源排列方式」这组模式切换,而是一枚资源动作按钮', async () => {
const projectPath = '/tmp/manual-layout-surface-project';
const tauri = installLayoutTauri({
projectIdsByPath: { [projectPath]: 'manual-layout-surface-project' },
@@ -783,13 +783,28 @@ describe('资源画布手动重排口径', () => {
within(sortGroup).queryByRole('button', { name: '整理画布' }),
).toBeNull();
// 它仍同一行、仍是同一枚动作按钮,只是搬出了那个 group。
// 它仍同一行里的同一枚动作按钮,只是搬出了那个 group、也离开了行尾
const rederiveButton = screen.getByRole('button', { name: '整理画布' });
expect(sortGroup.contains(rederiveButton)).toBe(false);
expect(rederiveButton.closest('.game-resource-sort-tabs')).toBeNull();
expect(
rederiveButton.closest('.game-workbench-view-actions'),
).not.toBeNull();
const actionsRow = rederiveButton.closest('.game-workbench-view-actions');
expect(actionsRow).not.toBeNull();
// 位置:不再是这一行的最后一个按钮(行尾会被读成"针对整个工具条"的动作),
// 紧跟「生成素材」,并且在排序组左侧。
const rowButtons = Array.from(actionsRow!.querySelectorAll('button'));
expect(rowButtons.at(-1)).not.toBe(rederiveButton);
const rederiveIndex = rowButtons.indexOf(rederiveButton);
const sortGroupIndex = rowButtons.findIndex((button) =>
sortGroup.contains(button),
);
expect(rederiveIndex).toBeGreaterThanOrEqual(0);
expect(sortGroupIndex).toBeGreaterThanOrEqual(0);
expect(rederiveIndex).toBeLessThan(sortGroupIndex);
expect(rederiveButton.previousElementSibling).toBe(
screen.getByRole('button', { name: '生成素材' }),
);
// 语义没变:可点性只跟布局就绪绑定,布局读完后它就是可点的。
await waitFor(() =>
expect(