mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-18 10:06:30 +03:00
fix(webui): include grouped tabs in range selection
This commit is contained in:
@@ -563,6 +563,7 @@ export const ChatList = memo(function ChatList({
|
|||||||
const next = new Set(current);
|
const next = new Set(current);
|
||||||
if (range) {
|
if (range) {
|
||||||
for (const key of range) next.add(key);
|
for (const key of range) next.add(key);
|
||||||
|
for (const key of validKeys) next.add(key);
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
const remove = validKeys.length > 0 && validKeys.every((key) => next.has(key));
|
const remove = validKeys.length > 0 && validKeys.every((key) => next.has(key));
|
||||||
|
|||||||
@@ -698,6 +698,50 @@ describe("ChatList", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("includes every pane when a Shift-click range ends on a grouped tab", async () => {
|
||||||
|
render(
|
||||||
|
<ChatList
|
||||||
|
sessions={[
|
||||||
|
session({ chatId: "first", title: "First topic" }),
|
||||||
|
session({ chatId: "root", title: "Root topic" }),
|
||||||
|
]}
|
||||||
|
activeKey="websocket:first"
|
||||||
|
paneGroups={{
|
||||||
|
"websocket:root": {
|
||||||
|
tabKey: "websocket:root",
|
||||||
|
title: "Root topic",
|
||||||
|
activePaneKey: "websocket:root",
|
||||||
|
panes: [
|
||||||
|
{ key: "websocket:root", chatId: "root", title: "Root topic" },
|
||||||
|
{ key: "websocket:child", chatId: "child", title: "Research pane" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
onSelect={vi.fn()}
|
||||||
|
onRequestDelete={vi.fn()}
|
||||||
|
onTogglePin={vi.fn()}
|
||||||
|
onRequestRename={vi.fn()}
|
||||||
|
onToggleArchive={vi.fn()}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
fireEvent.pointerDown(screen.getByRole("button", {
|
||||||
|
name: "Topic actions for First topic",
|
||||||
|
}), { button: 0, ctrlKey: false });
|
||||||
|
fireEvent.click(await screen.findByRole("menuitem", { name: "Select" }));
|
||||||
|
fireEvent.click(screen.getByRole("button", { name: "Group: Root topic" }), {
|
||||||
|
shiftKey: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(screen.getByText("3 selected")).toBeInTheDocument();
|
||||||
|
expect(screen.getByRole("button", { name: "Group: Root topic" }))
|
||||||
|
.toHaveAttribute("aria-pressed", "true");
|
||||||
|
expect(screen.getByRole("button", { name: "Root topic" }))
|
||||||
|
.toHaveAttribute("aria-pressed", "true");
|
||||||
|
expect(screen.getByRole("button", { name: "Research pane" }))
|
||||||
|
.toHaveAttribute("aria-pressed", "true");
|
||||||
|
});
|
||||||
|
|
||||||
it("shows temporary chats separately and lets the user reopen or close them", async () => {
|
it("shows temporary chats separately and lets the user reopen or close them", async () => {
|
||||||
const temporarySession = session({
|
const temporarySession = session({
|
||||||
key: "temporary:temporary-one",
|
key: "temporary:temporary-one",
|
||||||
|
|||||||
Reference in New Issue
Block a user