fix(input) Resolve cases where escape was broken (#6304)

This commit is contained in:
Jacob Richman
2025-08-15 10:54:00 -07:00
committed by GitHub
parent 1a2906a8ad
commit bd5e49c5ff
14 changed files with 697 additions and 582 deletions

View File

@@ -4,14 +4,16 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { render } from 'ink-testing-library';
import { renderWithProviders } from '../../test-utils/render.js';
import { waitFor } from '@testing-library/react';
import { vi } from 'vitest';
import { FolderTrustDialog, FolderTrustChoice } from './FolderTrustDialog.js';
describe('FolderTrustDialog', () => {
it('should render the dialog with title and description', () => {
const { lastFrame } = render(<FolderTrustDialog onSelect={vi.fn()} />);
const { lastFrame } = renderWithProviders(
<FolderTrustDialog onSelect={vi.fn()} />,
);
expect(lastFrame()).toContain('Do you trust this folder?');
expect(lastFrame()).toContain(
@@ -21,7 +23,9 @@ describe('FolderTrustDialog', () => {
it('should call onSelect with DO_NOT_TRUST when escape is pressed', async () => {
const onSelect = vi.fn();
const { stdin } = render(<FolderTrustDialog onSelect={onSelect} />);
const { stdin } = renderWithProviders(
<FolderTrustDialog onSelect={onSelect} />,
);
stdin.write('\x1b');