feat(web): Outliner Data menu deletes collections and hierarchies

Outliner rows now carry the native collection identity (collectionId), so
the Data menu can resolve a collection row the same way rename does. The
menu gains 删除集合 / 删除层级, dispatching the existing deleteCollection
edits with hierarchy false/true, matching the desktop collection context
menu.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-30 14:20:22 +08:00
parent 0f4ab653c6
commit 475bbd5e73
9 changed files with 42 additions and 14 deletions

View File

@@ -401,6 +401,24 @@ test.describe("Outliner headed baseline", () => {
await expect(page.locator(`.outliner-tree [role="treeitem"][aria-label="${label}"]`)).toHaveCount(0);
});
test("[outliner-collection-delete-web] Delete Hierarchy removes the collection and its contents", async ({ page }) => {
test.setTimeout(150_000);
await openWorkbench(page);
const objectRows = page.locator('.outliner-tree .tree-row[data-node-id]:not([data-node-id=""])');
const collectionRow = page.locator('.outliner-tree [role="treeitem"][aria-label="Collection"]');
await expect(collectionRow).toHaveCount(1, { timeout: 20_000 });
const before = await objectRows.count();
expect(before).toBeGreaterThan(0);
/* The fixture nests BasicArea/BasicCamera/BasicCube inside "Collection"; the
* desktop collection menu's Delete Hierarchy removes the collection with
* everything under it. */
await collectionRow.locator(".tree-node-name").first().click({ button: "right" });
await expect(page.getByRole("menuitem", { name: "删除层级", exact: true })).toBeEnabled({ timeout: 15_000 });
await page.getByRole("menuitem", { name: "删除层级", exact: true }).click();
await expect.poll(() => objectRows.count(), { timeout: 20_000 }).toBe(0);
await expect(collectionRow).toHaveCount(0);
});
test("[outliner-id-clipboard-web] Copy and Paste run OUTLINER_OT_id_copy and id_paste", async ({ page }) => {
test.setTimeout(150_000);
await openWorkbench(page);