mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-22 03:51:22 -07:00
feat(cli): enhance folder trust with configuration discovery and security warnings (#19492)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -108,7 +108,27 @@ describe('<Scrollable />', () => {
|
||||
throw new Error('capturedEntry is undefined');
|
||||
}
|
||||
|
||||
// Initial state (starts at bottom because of auto-scroll logic)
|
||||
// Initial state (starts at top by default)
|
||||
expect(capturedEntry.getScrollState().scrollTop).toBe(0);
|
||||
|
||||
// Initial state with scrollToBottom={true}
|
||||
unmount();
|
||||
const { waitUntilReady: waitUntilReady2, unmount: unmount2 } =
|
||||
renderWithProviders(
|
||||
<Scrollable hasFocus={true} height={5} scrollToBottom={true}>
|
||||
<Text>Line 1</Text>
|
||||
<Text>Line 2</Text>
|
||||
<Text>Line 3</Text>
|
||||
<Text>Line 4</Text>
|
||||
<Text>Line 5</Text>
|
||||
<Text>Line 6</Text>
|
||||
<Text>Line 7</Text>
|
||||
<Text>Line 8</Text>
|
||||
<Text>Line 9</Text>
|
||||
<Text>Line 10</Text>
|
||||
</Scrollable>,
|
||||
);
|
||||
await waitUntilReady2();
|
||||
expect(capturedEntry.getScrollState().scrollTop).toBe(5);
|
||||
|
||||
// Call scrollBy multiple times (upwards) in the same tick
|
||||
@@ -116,14 +136,14 @@ describe('<Scrollable />', () => {
|
||||
capturedEntry!.scrollBy(-1);
|
||||
capturedEntry!.scrollBy(-1);
|
||||
});
|
||||
// Should have moved up by 2
|
||||
// Should have moved up by 2 (5 -> 3)
|
||||
expect(capturedEntry.getScrollState().scrollTop).toBe(3);
|
||||
|
||||
await act(async () => {
|
||||
capturedEntry!.scrollBy(-2);
|
||||
});
|
||||
expect(capturedEntry.getScrollState().scrollTop).toBe(1);
|
||||
unmount();
|
||||
unmount2();
|
||||
});
|
||||
|
||||
describe('keypress handling', () => {
|
||||
|
||||
@@ -54,8 +54,7 @@ export const Scrollable: React.FC<ScrollableProps> = ({
|
||||
const childrenCountRef = useRef(0);
|
||||
|
||||
// This effect needs to run on every render to correctly measure the container
|
||||
// and scroll to the bottom if new children are added. The if conditions
|
||||
// prevent infinite loops.
|
||||
// and scroll to the bottom if new children are added.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
useLayoutEffect(() => {
|
||||
if (!ref.current) {
|
||||
@@ -64,7 +63,8 @@ export const Scrollable: React.FC<ScrollableProps> = ({
|
||||
const innerHeight = Math.round(getInnerHeight(ref.current));
|
||||
const scrollHeight = Math.round(getScrollHeight(ref.current));
|
||||
|
||||
const isAtBottom = scrollTop >= size.scrollHeight - size.innerHeight - 1;
|
||||
const isAtBottom =
|
||||
scrollHeight > innerHeight && scrollTop >= scrollHeight - innerHeight - 1;
|
||||
|
||||
if (
|
||||
size.innerHeight !== innerHeight ||
|
||||
|
||||
Reference in New Issue
Block a user