fix(webui): complete temporary chat mode

This commit is contained in:
chengyongru
2026-08-08 23:20:59 +08:00
committed by Xubin Ren
parent c9a6145878
commit a5bc3bfbb9
51 changed files with 1285 additions and 945 deletions
+35
View File
@@ -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({