mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-27 17:00:06 +02:00

* Rename files to tsx * Update types * Remove props that aren't typed * Add `LayoutContextOwnStates` * Use `LayoutContextOwnStates` * Ignore ts errors about `SocketIOMock` * Address comments: remove `satisfies`, update `BroadcastChannel` fixture * Add types to `makeEditorOpenDocProvider`. Update `openDocId`->`currentDocumentId` * misc. * Type sockets as `SocketIOMock & Socket` * Fix remaining typing errors * Fix type of `ideReactContextValue` GitOrigin-RevId: 2734ac707517d56c452b0bf06ea3438f947a64be
20 lines
587 B
TypeScript
20 lines
587 B
TypeScript
import React from 'react'
|
|
import { render, type RenderOptions } from '@testing-library/react'
|
|
import { EditorProviders, type EditorProvidersProps } from './editor-providers'
|
|
|
|
export function renderWithEditorContext(
|
|
component: React.ReactElement,
|
|
contextProps: EditorProvidersProps = {},
|
|
renderOptions: RenderOptions = {}
|
|
) {
|
|
const EditorProvidersWrapper = ({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) => <EditorProviders {...contextProps}>{children}</EditorProviders>
|
|
|
|
return render(component, {
|
|
wrapper: EditorProvidersWrapper,
|
|
...renderOptions,
|
|
})
|
|
}
|