fix(webui): stabilize thread during IME input

This commit is contained in:
chengyongru
2026-08-03 16:41:08 +08:00
committed by chengyongru
parent ac216c3e94
commit eeecfac538
4 changed files with 73 additions and 0 deletions
+27
View File
@@ -441,6 +441,33 @@ describe("ThreadComposer", () => {
expect(input.parentElement?.parentElement?.className).toContain("max-w-[58rem]");
});
it("defers textarea autosizing until IME composition commits", () => {
render(
<ThreadComposer
onSend={vi.fn()}
placeholder="Type your message..."
/>,
);
const input = screen.getByLabelText("Message input") as HTMLTextAreaElement;
Object.defineProperty(input, "scrollHeight", {
configurable: true,
value: 120,
});
input.style.height = "50px";
fireEvent.input(input, {
target: { value: "zhongwen" },
isComposing: true,
});
expect(input.style.height).toBe("50px");
fireEvent.input(input, {
target: { value: "中文" },
isComposing: false,
});
expect(input.style.height).toBe("120px");
});
it("lets long model preset labels use their intrinsic width", () => {
render(
<ThreadComposer