diff --git a/README.md b/README.md index 38abd4e..ee23d4a 100644 --- a/README.md +++ b/README.md @@ -248,7 +248,7 @@ Links: [build]: https://travis-ci.org/testing-library/svelte-testing-library [coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/svelte-testing-library.svg?style=flat-square [coverage]: https://codecov.io/github/testing-library/svelte-testing-library -[version-badge]: https://img.shields.io/npm/v/svelte-testing-library.svg?style=flat-square +[version-badge]: https://img.shields.io/npm/v/svlt-testing-library.svg?style=flat-square [package]: https://www.npmjs.com/package/svelte-testing-library [downloads-badge]: https://img.shields.io/npm/dm/svelte-testing-library.svg?style=flat-square [npmtrends]: http://www.npmtrends.com/svelte-testing-library diff --git a/src/index.js b/src/index.js index 2258231..eff31a0 100644 --- a/src/index.js +++ b/src/index.js @@ -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,