fix(webui): tighten interactive motion
This commit is contained in:
@@ -385,7 +385,7 @@ describe("AgentActivityCluster", () => {
|
||||
|
||||
expect(screen.getByTestId("agent-activity-scroll")).toBeInTheDocument();
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(901);
|
||||
vi.advanceTimersByTime(301);
|
||||
});
|
||||
expect(screen.queryByTestId("agent-activity-scroll")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Thought" })).toHaveAttribute(
|
||||
@@ -413,12 +413,13 @@ describe("AgentActivityCluster", () => {
|
||||
);
|
||||
|
||||
const button = screen.getByRole("button", { name: "Thought" });
|
||||
expect(button).toHaveAttribute("data-thread-disclosure");
|
||||
const chevron = button.querySelector("svg");
|
||||
expect(chevron).toBeInTheDocument();
|
||||
expect(chevron).toHaveClass("transition-colors", "duration-200");
|
||||
expect(chevron?.parentElement).toHaveClass(
|
||||
"transition-transform",
|
||||
"[transition-duration:600ms]",
|
||||
"[transition-duration:220ms]",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user