Skip to content

Commit 68bcdc1

Browse files
duncanleungKent C. Dodds
authored and
Kent C. Dodds
committed
docs: add render options Example for container (#132)
* README: Add render options container example * README: Revert unrelated changes due to auto-formatting
1 parent 2baff57 commit 68bcdc1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,19 @@ append that div to the `document.body` and this is where your react component
192192
will be rendered. If you provide your own HTMLElement `container` via this
193193
option, it will not be appended to the `document.body` automatically.
194194

195+
For Example:
196+
If you are unit testing a `tablebody` element, it cannot be a child of a `div`.
197+
In this case, you can specify a `table` as the render `container`.
198+
199+
```javascript
200+
const table = document.createElement('table');
201+
202+
const { container } = render(
203+
<TableBody {...props} />,
204+
{ container: document.body.appendChild(table) }
205+
);
206+
```
207+
195208
**baseElement**: If the `container` is specified, then this defaults to that,
196209
otherwise this defaults to `document.documentElement`. This is used as the base
197210
element for the queries as well as what is printed when you use `debug()`.

0 commit comments

Comments
 (0)