fix(chat): debounce post-send action menu
Docker Image / Build and Push Docker Image (push) Successful in 2m1s

This commit is contained in:
Codex
2026-07-23 20:03:26 +08:00
parent 4dae805a88
commit 92768047e9
2 changed files with 41 additions and 2 deletions
@@ -124,6 +124,36 @@ describe("ChatInputBar", () => {
expect(getButton("Open chat actions")).not.toBeNull();
});
it("suppresses the Facebook WebView click that follows a pointer send for 300ms", () => {
const now = vi.spyOn(Date, "now").mockReturnValue(1_000);
renderBar();
setTextareaValue(getTextarea(), "Hello Maya");
const sendButton = getButton("Send message");
const pointerDown = new Event("pointerdown", {
bubbles: true,
cancelable: true,
});
Object.defineProperty(pointerDown, "pointerType", { value: "touch" });
act(() => sendButton.dispatchEvent(pointerDown));
expect(mocks.dispatch).toHaveBeenCalledTimes(1);
expect(mocks.dispatch).toHaveBeenCalledWith({
type: "ChatSendMessage",
content: "Hello Maya",
});
expect(getTextarea().value).toBe("");
expect(getButton("Open chat actions")).toBe(sendButton);
now.mockReturnValue(1_299);
act(() => sendButton.click());
expect(container.querySelector('[aria-label="Chat actions"]')).toBeNull();
now.mockReturnValue(1_300);
act(() => sendButton.click());
expect(container.querySelector('[aria-label="Chat actions"]')).not.toBeNull();
});
it("closes the menu on outside interaction and when disabled", () => {
renderBar();
act(() => getButton("Open chat actions").click());