mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 21:03:05 -07:00
Polish sticky headers (#13024)
This commit is contained in:
@@ -293,6 +293,34 @@ describe('<ToolGroupMessage />', () => {
|
|||||||
expect(lastFrame()).toMatchSnapshot();
|
expect(lastFrame()).toMatchSnapshot();
|
||||||
unmount();
|
unmount();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('renders two tool groups where only the last line of the previous group is visible', () => {
|
||||||
|
const toolCalls1 = [
|
||||||
|
createToolCall({
|
||||||
|
callId: '1',
|
||||||
|
name: 'tool-1',
|
||||||
|
description: 'Description 1',
|
||||||
|
resultDisplay: 'line1\nline2\nline3\nline4\nline5',
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
const toolCalls2 = [
|
||||||
|
createToolCall({
|
||||||
|
callId: '2',
|
||||||
|
name: 'tool-2',
|
||||||
|
description: 'Description 2',
|
||||||
|
resultDisplay: 'line1',
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
const { lastFrame, unmount } = renderWithProviders(
|
||||||
|
<Scrollable height={6} hasFocus={true} scrollToBottom={true}>
|
||||||
|
<ToolGroupMessage {...baseProps} toolCalls={toolCalls1} />
|
||||||
|
<ToolGroupMessage {...baseProps} toolCalls={toolCalls2} />
|
||||||
|
</Scrollable>,
|
||||||
|
);
|
||||||
|
expect(lastFrame()).toMatchSnapshot();
|
||||||
|
unmount();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Border Color Logic', () => {
|
describe('Border Color Logic', () => {
|
||||||
|
|||||||
@@ -103,7 +103,6 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
{toolCalls.map((tool, index) => {
|
{toolCalls.map((tool, index) => {
|
||||||
const isConfirming = toolAwaitingApproval?.callId === tool.callId;
|
const isConfirming = toolAwaitingApproval?.callId === tool.callId;
|
||||||
const isFirst = index === 0;
|
const isFirst = index === 0;
|
||||||
const isLast = index === toolCalls.length - 1;
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
key={tool.callId}
|
key={tool.callId}
|
||||||
@@ -129,7 +128,7 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
borderLeft={true}
|
borderLeft={true}
|
||||||
borderRight={true}
|
borderRight={true}
|
||||||
borderTop={false}
|
borderTop={false}
|
||||||
borderBottom={isLast}
|
borderBottom={false}
|
||||||
borderColor={borderColor}
|
borderColor={borderColor}
|
||||||
borderDimColor={borderDimColor}
|
borderDimColor={borderDimColor}
|
||||||
flexDirection="column"
|
flexDirection="column"
|
||||||
@@ -161,6 +160,25 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
We have to keep the bottom border separate so it doesn't get
|
||||||
|
drawn over by the sticky header directly inside it.
|
||||||
|
*/
|
||||||
|
toolCalls.length > 0 && (
|
||||||
|
<Box
|
||||||
|
height={0}
|
||||||
|
width={terminalWidth}
|
||||||
|
borderLeft={true}
|
||||||
|
borderRight={true}
|
||||||
|
borderTop={false}
|
||||||
|
borderBottom={true}
|
||||||
|
borderColor={borderColor}
|
||||||
|
borderDimColor={borderDimColor}
|
||||||
|
borderStyle="round"
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -76,6 +76,15 @@ exports[`<ToolGroupMessage /> > Golden Snapshots > renders tool call with output
|
|||||||
╰──────────────────────────────────────────────────────────────────────────────╯"
|
╰──────────────────────────────────────────────────────────────────────────────╯"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`<ToolGroupMessage /> > Golden Snapshots > renders two tool groups where only the last line of the previous group is visible 1`] = `
|
||||||
|
"╰──────────────────────────────────────────────────────────────────────────────╯
|
||||||
|
╭──────────────────────────────────────────────────────────────────────────────╮
|
||||||
|
│ ✓ tool-2 Description 2 │
|
||||||
|
│ │ ▄
|
||||||
|
│ line1 │ █
|
||||||
|
╰──────────────────────────────────────────────────────────────────────────────╯ █"
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`<ToolGroupMessage /> > Golden Snapshots > renders when not focused 1`] = `
|
exports[`<ToolGroupMessage /> > Golden Snapshots > renders when not focused 1`] = `
|
||||||
"MockTool[tool-123]: ✓ test-tool - A tool for testing (medium)
|
"MockTool[tool-123]: ✓ test-tool - A tool for testing (medium)
|
||||||
╰──────────────────────────────────────────────────────────────────────────────╯"
|
╰──────────────────────────────────────────────────────────────────────────────╯"
|
||||||
|
|||||||
Reference in New Issue
Block a user