fix(webui): tighten interactive motion

This commit is contained in:
chengyongru
2026-08-06 18:28:45 +08:00
committed by chengyongru
parent a95fd0ee82
commit 223b911e7e
9 changed files with 64 additions and 18 deletions
+28
View File
@@ -215,6 +215,34 @@ function ViewportWithPromptNavigator({ messages }: { messages: UIMessage[] }) {
}
describe("ThreadViewport", () => {
it("keeps reasoning disclosure anchored for pointer and keyboard toggles", () => {
const takeUserControl = vi.spyOn(
ThreadMotionCoordinator.prototype,
"takeUserControl",
);
render(
<ThreadViewport
messages={[{
id: "reasoning-1",
role: "assistant",
content: "",
reasoning: "A completed thought",
createdAt: 1,
}]}
isStreaming={false}
composer={<div>composer</div>}
/>,
);
const disclosure = screen.getByRole("button", { name: "Thought" });
fireEvent.pointerDown(disclosure, { button: 0 });
expect(takeUserControl).toHaveBeenCalledTimes(1);
takeUserControl.mockClear();
fireEvent.keyDown(disclosure, { key: "Enter" });
expect(takeUserControl).toHaveBeenCalledTimes(1);
});
it("top-aligns short threads in the message rendering area", () => {
render(
<ThreadViewport