overleaf/services/web/test/frontend/helpers/render-with-context.jsx
Jakob Ackermann aa480a2663 Merge pull request #18898 from overleaf/jpa-no-window
[web] migrate from window attributes to getMeta

GitOrigin-RevId: 3dcf1ab6b01155e5e4abeb3e78d0fa9053e055bc
2024-06-19 08:04:21 +00:00

24 lines
563 B
JavaScript

// Disable prop type checks for test harnesses
/* eslint-disable react/prop-types */
import { render } from '@testing-library/react'
import { EditorProviders } from './editor-providers'
export function renderWithEditorContext(
component,
contextProps,
renderOptions = {}
) {
const EditorProvidersWrapper = ({ children }) => (
<EditorProviders {...contextProps}>{children}</EditorProviders>
)
return render(component, {
wrapper: EditorProvidersWrapper,
...renderOptions,
})
}
export function cleanUpContext() {
delete window._ide
}