Skip to content

Commit 8b1e52c

Browse files
test(web): file tree dragend deselects dragged rows and re-enables opening
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 00a01f6 commit 8b1e52c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎apps/web/src/components/files/FileBrowserPanel.browser.test.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function findTreeRow(path: string): HTMLElement | null {
4343
}
4444

4545
describe("FileBrowserPanel", () => {
46-
it("dragging a file row carries a composer mention and does not open the file", async () => {
46+
it("dragging a file row carries a composer mention without opening it, and dragend releases it", async () => {
4747
const onOpenFile = vi.fn();
4848
await using _screen = await render(
4949
<FileBrowserPanel
@@ -63,8 +63,17 @@ describe("FileBrowserPanel", () => {
6363
row.dispatchEvent(
6464
new DragEvent("dragstart", { bubbles: true, cancelable: true, composed: true, dataTransfer }),
6565
);
66+
// The tree selects the row the drag picked up; mid-drag that must not open it.
67+
row.click();
68+
await vi.waitFor(() => expect(row.getAttribute("aria-selected")).toBe("true"));
6669

6770
expect(dataTransfer.getData(COMPOSER_MENTION_DRAG_TYPE)).toContain("README.md");
6871
expect(onOpenFile).not.toHaveBeenCalled();
72+
73+
row.dispatchEvent(new DragEvent("dragend", { bubbles: true, composed: true, dataTransfer }));
74+
await vi.waitFor(() => expect(row.getAttribute("aria-selected")).not.toBe("true"));
75+
76+
row.click();
77+
await vi.waitFor(() => expect(onOpenFile).toHaveBeenCalledTimes(1));
6978
});
7079
});

0 commit comments

Comments
 (0)