fix(webui): name temporary chats from first message

This commit is contained in:
chengyongru
2026-08-08 23:20:59 +08:00
committed by Xubin Ren
parent 516ae11c33
commit 8e04f12720
5 changed files with 20 additions and 6 deletions
+4 -1
View File
@@ -466,7 +466,10 @@ describe("App layout", () => {
name: "first private message",
}));
await waitFor(() => expect(window.location.hash).toBe(firstHash));
expect(screen.getByText("Temporary chat")).toBeInTheDocument();
expect(within(screen.getByTestId("thread-header")).getByText(
"first private message",
)).toBeInTheDocument();
await waitFor(() => expect(document.title).toBe("first private message · nanobot"));
expect(screen.queryByRole("button", { name: "Temporary chat" })).not.toBeInTheDocument();
fireEvent.click(within(sidebar).getByRole("button", {
+3 -3
View File
@@ -156,7 +156,7 @@ describe("ChatList", () => {
const temporarySession = session({
key: "temporary:temporary-one",
chatId: "temporary-one",
preview: "Private planning",
preview: "hi",
});
const onSelect = vi.fn();
const onClose = vi.fn();
@@ -176,11 +176,11 @@ describe("ChatList", () => {
);
const section = screen.getByRole("region", { name: "Temporary chats" });
fireEvent.click(within(section).getByRole("button", { name: "Private planning" }));
fireEvent.click(within(section).getByRole("button", { name: "hi" }));
expect(onSelect).toHaveBeenCalledWith("temporary:temporary-one");
fireEvent.click(within(section).getByRole("button", {
name: "Close temporary chat: Private planning",
name: "Close temporary chat: hi",
}));
expect(onClose).toHaveBeenCalledWith("temporary:temporary-one");
});