Skip to content

Commit

Permalink
docs: add render options Example for container (#132)
Browse files Browse the repository at this point in the history
* README: Add render options container example

* README: Revert unrelated changes due to auto-formatting
  • Loading branch information
duncanleung authored and Kent C. Dodds committed Jul 8, 2018
1 parent 2baff57 commit 68bcdc1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ append that div to the `document.body` and this is where your react component
will be rendered. 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 `tablebody` element, it cannot be a child of a `div`.
In this case, you can specify a `table` as the render `container`.

```javascript
const table = document.createElement('table');
const { container } = render(
<TableBody {...props} />,
{ container: document.body.appendChild(table) }
);
```

**baseElement**: If the `container` is specified, then this defaults to that,
otherwise this defaults to `document.documentElement`. This is used as the base
element for the queries as well as what is printed when you use `debug()`.
Expand Down

0 comments on commit 68bcdc1

Please sign in to comment.