Interface RenderOptions<Q, Container, BaseElement>

Type Parameters

Hierarchy

  • RenderOptions

Properties

baseElement?: BaseElement

Defaults to the container if the container is specified. Otherwise document.body is used for the default. This is used as the base element for the queries as well as what is printed when you use debug().

container?: Container

By default, React Testing Library will create a div and append that div to the document.body. Your React component will be rendered in the created div. If you provide your own HTMLElement container via this option, it will not be appended to the document.body automatically.

For example: If you are unit testing a <tbody> element, it cannot be a child of a div. In this case, you can specify a table as the render container.

hydrate?: boolean

If hydrate is set to true, then it will render with ReactDOM.hydrate. This may be useful if you are using server-side rendering and use ReactDOM.hydrate to mount your components.

legacyRoot?: boolean

Set to true if you want to force synchronous ReactDOM.render. Otherwise render will default to concurrent React if available.

queries?: Q

Queries to bind. Overrides the default set from DOM Testing Library unless merged.

wrapper?: JSXElementConstructor<{
    children: ReactElement<any, string | JSXElementConstructor<any>>;
}>

Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating reusable custom render functions for common data providers. See setup for examples.

Type declaration

Generated using TypeDoc