2025-08-15 10:54:00 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { render } from 'ink-testing-library';
|
2025-08-26 00:04:53 +02:00
|
|
|
import type React from 'react';
|
2025-08-15 10:54:00 -07:00
|
|
|
import { KeypressProvider } from '../ui/contexts/KeypressContext.js';
|
2025-09-20 10:59:37 -07:00
|
|
|
import { ShellFocusContext } from '../ui/contexts/ShellFocusContext.js';
|
2025-08-15 10:54:00 -07:00
|
|
|
|
|
|
|
|
export const renderWithProviders = (
|
|
|
|
|
component: React.ReactElement,
|
2025-09-20 10:59:37 -07:00
|
|
|
{ shellFocus = true } = {},
|
2025-08-15 10:54:00 -07:00
|
|
|
): ReturnType<typeof render> =>
|
|
|
|
|
render(
|
2025-09-20 10:59:37 -07:00
|
|
|
<ShellFocusContext.Provider value={shellFocus}>
|
|
|
|
|
<KeypressProvider kittyProtocolEnabled={true}>
|
|
|
|
|
{component}
|
|
|
|
|
</KeypressProvider>
|
|
|
|
|
</ShellFocusContext.Provider>,
|
2025-08-15 10:54:00 -07:00
|
|
|
);
|