fix(web): restore tool expansion directly

This commit is contained in:
Miguel Palhas
2026-09-05 08:59:20 +01:00
parent 443800bd79
commit 4a5c3b9982
3 changed files with 21 additions and 11 deletions
+5 -1
View File
@@ -116,7 +116,7 @@ describe("structured connection: data flow", () => {
conn.dispose();
});
it("keeps an expanded running tool open when its stable row is patched", () => {
it("keeps an expanded running tool open without emitting a click when patched", () => {
const ws = new FakeSocket();
const conn = mount({ sockets: [ws] });
ws.open();
@@ -138,6 +138,8 @@ describe("structured connection: data flow", () => {
const originalHead = conn.el.querySelector<HTMLButtonElement>(".st-tool-head")!;
originalHead.click();
expect(originalHead.getAttribute("aria-expanded")).toBe("true");
const clickListener = vi.fn();
window.addEventListener("click", clickListener, { capture: true, once: true });
ws.emit({
type: "projection_update",
@@ -152,6 +154,8 @@ describe("structured connection: data flow", () => {
state: idleState,
});
expect(clickListener).not.toHaveBeenCalled();
window.removeEventListener("click", clickListener, true);
const patchedHead = conn.el.querySelector<HTMLButtonElement>(".st-tool-head")!;
expect(patchedHead).not.toBe(originalHead);
expect(patchedHead.getAttribute("aria-expanded")).toBe("true");