mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-18 10:01:29 -07:00
chore: add space to toggle footer
This commit is contained in:
committed by
Keith Guerin
parent
2d3b43b3c1
commit
88c8e9cca6
@@ -22,23 +22,25 @@ describe('<FooterConfigDialog />', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('renders correctly with default settings', () => {
|
||||
it('renders correctly with default settings', async () => {
|
||||
const settings = createMockSettings();
|
||||
const { lastFrame } = renderWithProviders(
|
||||
const { lastFrame, waitUntilReady } = renderWithProviders(
|
||||
<FooterConfigDialog onClose={mockOnClose} />,
|
||||
{ settings },
|
||||
);
|
||||
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('toggles an item when enter is pressed', async () => {
|
||||
const settings = createMockSettings();
|
||||
const { lastFrame, stdin } = renderWithProviders(
|
||||
const { lastFrame, stdin, waitUntilReady } = renderWithProviders(
|
||||
<FooterConfigDialog onClose={mockOnClose} />,
|
||||
{ settings },
|
||||
);
|
||||
|
||||
await waitUntilReady();
|
||||
act(() => {
|
||||
stdin.write('\r'); // Enter to toggle
|
||||
});
|
||||
@@ -58,11 +60,12 @@ describe('<FooterConfigDialog />', () => {
|
||||
|
||||
it('reorders items with arrow keys', async () => {
|
||||
const settings = createMockSettings();
|
||||
const { lastFrame, stdin } = renderWithProviders(
|
||||
const { lastFrame, stdin, waitUntilReady } = renderWithProviders(
|
||||
<FooterConfigDialog onClose={mockOnClose} />,
|
||||
{ settings },
|
||||
);
|
||||
|
||||
await waitUntilReady();
|
||||
// Initial order: cwd, git-branch, ...
|
||||
const output = lastFrame();
|
||||
const cwdIdx = output!.indexOf('] cwd');
|
||||
@@ -88,11 +91,12 @@ describe('<FooterConfigDialog />', () => {
|
||||
|
||||
it('closes on Esc', async () => {
|
||||
const settings = createMockSettings();
|
||||
const { stdin } = renderWithProviders(
|
||||
const { stdin, waitUntilReady } = renderWithProviders(
|
||||
<FooterConfigDialog onClose={mockOnClose} />,
|
||||
{ settings },
|
||||
);
|
||||
|
||||
await waitUntilReady();
|
||||
act(() => {
|
||||
stdin.write('\x1b'); // Esc
|
||||
});
|
||||
@@ -104,11 +108,12 @@ describe('<FooterConfigDialog />', () => {
|
||||
|
||||
it('highlights the active item in the preview', async () => {
|
||||
const settings = createMockSettings();
|
||||
const { lastFrame, stdin } = renderWithProviders(
|
||||
const { lastFrame, stdin, waitUntilReady } = renderWithProviders(
|
||||
<FooterConfigDialog onClose={mockOnClose} />,
|
||||
{ settings },
|
||||
);
|
||||
|
||||
await waitUntilReady();
|
||||
expect(lastFrame()).toContain('~/project/path');
|
||||
|
||||
// Move focus down to 'git-branch'
|
||||
@@ -123,11 +128,12 @@ describe('<FooterConfigDialog />', () => {
|
||||
|
||||
it('shows an empty preview when all items are deselected', async () => {
|
||||
const settings = createMockSettings();
|
||||
const { lastFrame, stdin } = renderWithProviders(
|
||||
const { lastFrame, stdin, waitUntilReady } = renderWithProviders(
|
||||
<FooterConfigDialog onClose={mockOnClose} />,
|
||||
{ settings },
|
||||
);
|
||||
|
||||
await waitUntilReady();
|
||||
for (let i = 0; i < 10; i++) {
|
||||
act(() => {
|
||||
stdin.write('\r'); // Toggle (deselect)
|
||||
|
||||
@@ -224,7 +224,7 @@ export const FooterConfigDialog: React.FC<FooterConfigDialogProps> = ({
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keyMatchers[Command.RETURN](key)) {
|
||||
if (keyMatchers[Command.RETURN](key) || key.name === 'space') {
|
||||
if (isResetFocused) {
|
||||
handleResetToDefaults();
|
||||
} else if (isShowLabelsFocused) {
|
||||
@@ -378,7 +378,7 @@ export const FooterConfigDialog: React.FC<FooterConfigDialogProps> = ({
|
||||
|
||||
<Box marginTop={1} flexDirection="column">
|
||||
<Text color={theme.text.secondary}>
|
||||
↑/↓ navigate · ←/→ reorder · enter select · esc close
|
||||
↑/↓ navigate · ←/→ reorder · enter/space select · esc close
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -1,33 +1,34 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`<FooterConfigDialog /> > renders correctly with default settings 1`] = `
|
||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ │
|
||||
│ Configure Footer │
|
||||
│ │
|
||||
│ Select which items to display in the footer. │
|
||||
│ │
|
||||
│ > [✓] cwd Current working directory │
|
||||
│ [✓] git-branch Current git branch name (not shown when unavailable) │
|
||||
│ [✓] sandbox-status Sandbox type and trust indicator │
|
||||
│ [✓] model-name Current model identifier │
|
||||
│ [✓] usage-limit Remaining usage on daily limit (not shown when unavailable) │
|
||||
│ [ ] context-remaining Percentage of context window remaining │
|
||||
│ [ ] memory-usage Memory used by the application │
|
||||
│ [ ] session-id Unique identifier for the current session │
|
||||
│ [ ] code-changes Lines added/removed in the session (not shown when zero) │
|
||||
│ [ ] token-count Total tokens used in the session (not shown when zero) │
|
||||
│ │
|
||||
│ [✓] Show footer labels │
|
||||
│ Reset to default footer │
|
||||
│ │
|
||||
│ ↑/↓ navigate · ←/→ reorder · enter select · esc close │
|
||||
│ │
|
||||
│ ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ Preview: │ │
|
||||
│ │ Path Branch /docs /model /stats │ │
|
||||
│ │ ~/project/path main docker gemini-2.5-pro daily 97% │ │
|
||||
│ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ │
|
||||
│ Configure Footer │
|
||||
│ │
|
||||
│ Select which items to display in the footer. │
|
||||
│ │
|
||||
│ > [✓] cwd Current working directory │
|
||||
│ [✓] git-branch Current git branch name (not shown when unavailable) │
|
||||
│ [✓] sandbox-status Sandbox type and trust indicator │
|
||||
│ [✓] model-name Current model identifier │
|
||||
│ [✓] usage-limit Remaining usage on daily limit (not shown when unavailable) │
|
||||
│ [ ] context-remaining Percentage of context window remaining │
|
||||
│ [ ] memory-usage Memory used by the application │
|
||||
│ [ ] session-id Unique identifier for the current session │
|
||||
│ [ ] code-changes Lines added/removed in the session (not shown when zero) │
|
||||
│ [ ] token-count Total tokens used in the session (not shown when zero) │
|
||||
│ │
|
||||
│ [✓] Show footer labels │
|
||||
│ Reset to default footer │
|
||||
│ │
|
||||
│ ↑/↓ navigate · ←/→ reorder · enter/space select · esc close │
|
||||
│ │
|
||||
│ ┌────────────────────────────────────────────────────────────────────────────────────────────┐ │
|
||||
│ │ Preview: │ │
|
||||
│ │ Path Branch /docs /model /stats │ │
|
||||
│ │ ~/project/path main docker gemini-2.5-pro daily 97% │ │
|
||||
│ └────────────────────────────────────────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
"
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user