fix(chat): restore windowed turn alignment
Keep the virtual-window measurement wrapper as a flex column so AgentTurn alignSelf rules remain active. Add regression coverage for the alignment context.
This commit is contained in:
@@ -216,6 +216,27 @@ describe("AgentWorkspace", () => {
|
||||
expect(renderCounts.size).toBeLessThan(40);
|
||||
});
|
||||
|
||||
it("preserves the flex alignment context around windowed turns", () => {
|
||||
const messages = Array.from({ length: 41 }, (_, index): Message => ({
|
||||
id: `message-${index}`,
|
||||
role: index % 2 === 0 ? "user" : "assistant",
|
||||
content: `message ${index}`,
|
||||
}));
|
||||
|
||||
render(
|
||||
<AgentWorkspace
|
||||
{...defaultProps}
|
||||
isStreaming={false}
|
||||
messages={messages}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByTestId("turn-message-0").parentElement).toHaveStyle({
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps visible turns mounted when crossing the windowing threshold", () => {
|
||||
const messages = Array.from({ length: 41 }, (_, index): Message => ({
|
||||
id: `message-${index}`,
|
||||
|
||||
@@ -254,7 +254,12 @@ const MeasuredTurn = ({
|
||||
return (
|
||||
<Box
|
||||
ref={rowRef}
|
||||
sx={{ mb: measure ? `${TURN_GAP_PX}px` : 0, flexShrink: 0 }}
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
flexShrink: 0,
|
||||
mb: measure ? `${TURN_GAP_PX}px` : 0,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user