Skip to content

Commit fbacb0d

Browse files
ImADraftereps1lon
andauthored
feat: improve JSDocs for RenderOptions (#909)
Co-authored-by: Sebastian Silbermann <[email protected]>
1 parent 071a6fd commit fbacb0d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

types/index.d.ts

+32
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,42 @@ export interface RenderOptions<
3434
Q extends Queries = typeof queries,
3535
Container extends Element | DocumentFragment = HTMLElement,
3636
> {
37+
/**
38+
* 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,
39+
* it will not be appended to the document.body automatically.
40+
*
41+
* For example: If you are unit testing a `<tbody>` element, it cannot be a child of a div. In this case, you can
42+
* specify a table as the render container.
43+
*
44+
* @see https://testing-library.com/docs/react-testing-library/api/#container
45+
*/
3746
container?: Container
47+
/**
48+
* Defaults to the container if the container is specified. Otherwise `document.body` is used for the default. This is used as
49+
* the base element for the queries as well as what is printed when you use `debug()`.
50+
*
51+
* @see https://testing-library.com/docs/react-testing-library/api/#baseelement
52+
*/
3853
baseElement?: Element
54+
/**
55+
* If `hydrate` is set to `true`, then it will render with `ReactDOM.hydrate`. This may be useful if you are using server-side
56+
* rendering and use ReactDOM.hydrate to mount your components.
57+
*
58+
* @see https://testing-library.com/docs/react-testing-library/api/#hydrate)
59+
*/
3960
hydrate?: boolean
61+
/**
62+
* Queries to bind. Overrides the default set from DOM Testing Library unless merged.
63+
*
64+
* @see https://testing-library.com/docs/react-testing-library/api/#queries
65+
*/
4066
queries?: Q
67+
/**
68+
* Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
69+
* reusable custom render functions for common data providers. See setup for examples.
70+
*
71+
* @see https://testing-library.com/docs/react-testing-library/api/#wrapper
72+
*/
4173
wrapper?: React.ComponentType
4274
}
4375

0 commit comments

Comments
 (0)