Skip to content

Commit 508e45f

Browse files
EmilTholinbenmonro
authored andcommitted
fix: Don't append target to body if target option is given (#20)
1 parent 88455b3 commit 508e45f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import {getQueriesForElement, prettyDOM} from 'dom-testing-library'
22

33
export * from 'dom-testing-library'
44
const mountedContainers = new Set()
5-
export const render = (Component, {target = document.createElement('div'), ...options} = {}) => {
6-
document.body.appendChild(target)
5+
export const render = (Component, {target, ...options} = {}) => {
6+
if (!target) {
7+
target = document.body.appendChild(document.createElement('div'))
8+
}
79

810
const component = new Component({
911
...options,

0 commit comments

Comments
 (0)