fix(webui): clarify queued guidance state

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-22 14:21:18 +08:00
1 parent 6bf604d43c
commit 04d396600b
12 files changed
+54 -30

No files matched your search

+13 -9
View File
@@ -2185,7 +2185,7 @@ describe("ThreadComposer", () => {
expect(screen.getByTestId("composer-session-mention-Plan")).toHaveTextContent("@Plan");
fireEvent.keyDown(input, { key: "Enter" });
fireEvent.click(screen.getByRole("button", { name: "Guide" }));
fireEvent.click(screen.getByRole("button", { name: "Send now" }));
expect(onSend).toHaveBeenCalledWith("@Plan", undefined, {
sessionMentions: [{
@@ -2891,8 +2891,12 @@ describe("ThreadComposer", () => {
expect(onSend).not.toHaveBeenCalled();
expect(input).toHaveValue("");
expect(screen.getByText("keep the UI minimal")).toBeInTheDocument();
expect(screen.getByText("Waiting to send")).toBeInTheDocument();
expect(screen.getByText(
"Send now, or wait for the current response to finish.",
)).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Guide" }));
fireEvent.click(screen.getByRole("button", { name: "Send now" }));
expect(onSend).toHaveBeenCalledWith(
"keep the UI minimal",
@@ -3079,14 +3083,14 @@ describe("ThreadComposer", () => {
fireEvent.change(input, { target: { value: "second follow-up" } });
fireEvent.keyDown(input, { key: "Enter" });
const queue = screen.getByRole("group", { name: "Queued guidance" });
const queue = screen.getByRole("group", { name: "Waiting to send" });
expect(queue).toHaveClass("composer-status-strip");
expect(queue).toHaveClass("mx-3");
expect(queue.parentElement?.className).toContain("group/composer");
expect(within(queue).getByText("first follow-up")).toBeInTheDocument();
expect(within(queue).getByText("second follow-up")).toBeInTheDocument();
expect(within(queue).getAllByRole("button", { name: "Edit guidance" })).toHaveLength(2);
expect(within(queue).getAllByRole("button", { name: "Guide" })).toHaveLength(2);
expect(within(queue).getAllByRole("button", { name: "Send now" })).toHaveLength(2);
rerender(
<ThreadComposer
@@ -3125,7 +3129,7 @@ describe("ThreadComposer", () => {
expect(onSend).toHaveBeenLastCalledWith("second follow-up");
});
expect(onSend).toHaveBeenCalledTimes(2);
expect(screen.queryByRole("group", { name: "Queued guidance" })).not.toBeInTheDocument();
expect(screen.queryByRole("group", { name: "Waiting to send" })).not.toBeInTheDocument();
});
it("lets users edit queued guidance before it is sent", async () => {
@@ -3158,7 +3162,7 @@ describe("ThreadComposer", () => {
expect(focusedSelections).toEqual([true]);
expect(textarea.selectionStart).toBe("rough follow-up".length);
expect(input).toHaveValue("rough follow-up");
expect(screen.queryByRole("group", { name: "Queued guidance" })).not.toBeInTheDocument();
expect(screen.queryByRole("group", { name: "Waiting to send" })).not.toBeInTheDocument();
fireEvent.change(input, { target: { value: "polished follow-up" } });
fireEvent.keyDown(input, { key: "Enter" });
@@ -3260,14 +3264,14 @@ describe("ThreadComposer", () => {
fireEvent.keyDown(input, { key: "Enter" });
expect(onSend).not.toHaveBeenCalled();
expect(screen.getByRole("group", { name: "Queued guidance" })).toBeInTheDocument();
expect(screen.getByRole("group", { name: "Waiting to send" })).toBeInTheDocument();
expect(screen.getByText("look at this")).toBeInTheDocument();
expect(screen.queryByTestId("composer-chip")).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Edit guidance" }));
expect(input).toHaveValue("look at this");
expect(screen.getByTestId("composer-chip")).toHaveTextContent("draft.png");
expect(screen.queryByRole("group", { name: "Queued guidance" })).not.toBeInTheDocument();
expect(screen.queryByRole("group", { name: "Waiting to send" })).not.toBeInTheDocument();
fireEvent.keyDown(input, { key: "Enter" });
rerender(
@@ -3479,7 +3483,7 @@ describe("ThreadComposer", () => {
expect(await screen.findByText("remember this edited follow-up")).toBeInTheDocument();
fireEvent.keyDown(screen.getByLabelText("Message input"), { key: "Enter" });
expect(onSend).not.toHaveBeenCalled();
fireEvent.click(screen.getByRole("button", { name: "Guide" }));
fireEvent.click(screen.getByRole("button", { name: "Send now" }));
expect(onSend).toHaveBeenCalledWith(
"remember this edited follow-up",
undefined,