mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-18 18:16:38 +03:00
fix(webui): complete temporary chat mode
This commit is contained in:
@@ -152,6 +152,41 @@ describe("ChatList", () => {
|
||||
expect(text.indexOf("Charlie")).toBeLessThan(text.indexOf("Alpha"));
|
||||
});
|
||||
|
||||
it("shows temporary chats separately and lets the user reopen or close them", async () => {
|
||||
const temporarySession = session({
|
||||
key: "temporary:temporary-one",
|
||||
chatId: "temporary-one",
|
||||
preview: "Private planning",
|
||||
});
|
||||
const onSelect = vi.fn();
|
||||
const onClose = vi.fn();
|
||||
|
||||
render(
|
||||
<ChatList
|
||||
sessions={[]}
|
||||
temporarySessions={[temporarySession]}
|
||||
activeKey={null}
|
||||
onSelect={onSelect}
|
||||
onCloseTemporaryChat={onClose}
|
||||
onRequestDelete={vi.fn()}
|
||||
onTogglePin={vi.fn()}
|
||||
onRequestRename={vi.fn()}
|
||||
onToggleArchive={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
const section = screen.getByRole("region", { name: "Temporary chats" });
|
||||
fireEvent.click(within(section).getByRole("button", { name: "Private planning" }));
|
||||
expect(onSelect).toHaveBeenCalledWith("temporary:temporary-one");
|
||||
|
||||
fireEvent.pointerDown(
|
||||
within(section).getByRole("button", { name: "Topic actions for Private planning" }),
|
||||
{ button: 0 },
|
||||
);
|
||||
fireEvent.click(await screen.findByRole("menuitem", { name: "Close temporary chat" }));
|
||||
expect(onClose).toHaveBeenCalledWith("temporary:temporary-one");
|
||||
});
|
||||
|
||||
it("orders chats by latest session activity by default", () => {
|
||||
const sessions = [
|
||||
session({
|
||||
|
||||
Reference in New Issue
Block a user