Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Sidebar test: a drag and Alt+Down plan among the rows left in place while Unread lists a bot of the same list

milind-sonie525d586197e
diff --git a/src/components/Sidebar.bot-reorder.dom.test.ts b/src/components/Sidebar.bot-reorder.dom.test.ts
index 33736b8fd2..d159da6c83 100644
--- a/src/components/Sidebar.bot-reorder.dom.test.ts
+++ b/src/components/Sidebar.bot-reorder.dom.test.ts
@@ -131,5 +131,19 @@ for (const advanced of [false, true]) {
dragOnto("delta", "bravo", "bottom");
expect(saved()).toEqual([{ type: "botsOrdered", botIds: ["delta", "alpha", "bravo", "charlie"] }]);
});
+
+ it("plans among the rows left in place while Unread lists another bot of the same list", () => {
+ // Saved alpha, bravo, charlie, delta, echo; delta is working, echo is unread and listed in Unread above.
+ const unread = bot("echo", { tasks: [{ threadId: "echo-t", title: "Chat", createdAt: 1, unread: true }] });
+ render([bot("alpha"), bot("bravo"), bot("charlie"), bot("delta", { busy: true }), unread]);
+ expect(order()).toEqual(["echo", "delta", "alpha", "bravo", "charlie"]);
+ dragOnto("charlie", "delta", "top");
+ expect(saved()).toEqual([{ type: "botsOrdered", botIds: ["charlie", "alpha", "bravo", "delta"] }]);
+ dispatch.mockReset();
+ flushSync(() => document.querySelector('[data-sidebar-bot-row="alpha"]')!
+ .dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown", altKey: true, bubbles: true, cancelable: true })));
+ expect(saved()).toEqual([{ type: "botsOrdered", botIds: ["bravo", "alpha", "charlie", "delta"] }]);
+ expect(document.body.textContent).toContain("Alpha moved to position 3 of 4");
+ });
});
}