From 508e45f581eeedfa3cecca6943ecee17efdb12a2 Mon Sep 17 00:00:00 2001 From: Emil Tholin Date: Mon, 6 May 2019 04:04:48 +0200 Subject: [PATCH 1/2] fix: Don't append target to body if target option is given (#20) --- src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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, From 8c5e369e404bc448b1a68409dd3e33a1dd2ef05f Mon Sep 17 00:00:00 2001 From: Ben Monro Date: Mon, 6 May 2019 17:35:58 -0700 Subject: [PATCH 2/2] docs: fixed version badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 433793a..d346985 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