Skip to content

Commit

Permalink
fix: Don't append target to body if target option is given (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilTholin authored and benmonro committed May 6, 2019
1 parent 88455b3 commit 508e45f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import {getQueriesForElement, prettyDOM} from 'dom-testing-library'

export * from 'dom-testing-library'
const mountedContainers = new Set()
export const render = (Component, {target = document.createElement('div'), ...options} = {}) => {
document.body.appendChild(target)
export const render = (Component, {target, ...options} = {}) => {
if (!target) {
target = document.body.appendChild(document.createElement('div'))
}

const component = new Component({
...options,
Expand Down

0 comments on commit 508e45f

Please sign in to comment.