fix(webui): feather clipped activity edges

This commit is contained in:
chengyongru
2026-08-05 11:10:46 +08:00
committed by chengyongru
parent 6e9ae5bd05
commit a54d5d14cb
4 changed files with 106 additions and 4 deletions
@@ -265,6 +265,53 @@ describe("AgentActivityCluster", () => {
}
});
it("feathers only the activity edges with clipped content", () => {
const raf = installAnimationFrameQueue();
try {
render(
<AgentActivityCluster
messages={activityMessages()}
isTurnStreaming
hasBodyBelow={false}
/>,
);
const scrollport = screen.getByTestId("agent-activity-scroll");
setScrollGeometry(scrollport, {
scrollHeight: 1000,
clientHeight: 120,
scrollTop: 0,
});
act(() => {
raf.flush();
});
expect(scrollport).toHaveAttribute("data-fade-top", "true");
expect(scrollport).toHaveAttribute("data-fade-bottom", "false");
scrollport.scrollTop = 440;
fireEvent.scroll(scrollport);
expect(scrollport).toHaveAttribute("data-fade-top", "true");
expect(scrollport).toHaveAttribute("data-fade-bottom", "true");
scrollport.scrollTop = 0;
fireEvent.scroll(scrollport);
expect(scrollport).toHaveAttribute("data-fade-top", "false");
expect(scrollport).toHaveAttribute("data-fade-bottom", "true");
setScrollGeometry(scrollport, {
scrollHeight: 100,
clientHeight: 120,
scrollTop: 0,
});
fireEvent.scroll(scrollport);
expect(scrollport).toHaveAttribute("data-fade-top", "false");
expect(scrollport).toHaveAttribute("data-fade-bottom", "false");
} finally {
raf.restore();
}
});
it("turns the live reasoning marker into an animated check when thinking completes", async () => {
const liveReasoning: UIMessage = {
id: "r-check",