Skip to content

Commit ab76a48

Browse files
committed
docs: improve JSDocs for RenderOptions
1 parent fe16376 commit ab76a48

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

types/index.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,38 @@ export interface RenderOptions<
3434
Q extends Queries = typeof queries,
3535
Container extends Element | DocumentFragment = HTMLElement
3636
> {
37+
/** By default, React Testing Library will create a div and append that div to the document.body and this is
38+
* where your React component will be rendered. If you provide your own HTMLElement container via this option,
39+
* it will not be appended to the document.body automatically.
40+
*
41+
* For example: If you are unit testing a tablebody element, it cannot be a child of a div. In this case, you can
42+
* specify a table as the render container.
43+
*
44+
* [Container](https://testing-library.com/docs/react-testing-library/api/#container)
45+
*/
3746
container?: Container
47+
/** If the container is specified, then this defaults to that, otherwise this defaults to document.body. This is used as
48+
* the base element for the queries as well as what is printed when you use debug().
49+
*
50+
* [BaseElement](https://testing-library.com/docs/react-testing-library/api/#baseelement)
51+
*/
3852
baseElement?: Element
53+
/** If hydrate is set to true, then it will render with ReactDOM.hydrate. This may be useful if you are using server-side
54+
* rendering and use ReactDOM.hydrate to mount your components.
55+
*
56+
* [Hydrate](https://testing-library.com/docs/react-testing-library/api/#hydrate)
57+
*/
3958
hydrate?: boolean
59+
/** Queries to bind. Overrides the default set from DOM Testing Library unless merged.
60+
*
61+
* [Queries](https://testing-library.com/docs/react-testing-library/api/#queries)
62+
*/
4063
queries?: Q
64+
/** Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
65+
* reusable custom render functions for common data providers. See setup for examples.
66+
*
67+
* [Wrapper](https://testing-library.com/docs/react-testing-library/api/#wrapper)
68+
*/
4169
wrapper?: React.ComponentType
4270
}
4371

0 commit comments

Comments
 (0)