Skip to content

Commit 0cd096d

Browse files
author
Ben Monro
committed
fix: made cleanup test a bit more specific / independant
1 parent 9e6594d commit 0cd096d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

README.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ practices.</p>
3636
[![Watch on GitHub][github-watch-badge]][github-watch]
3737
[![Star on GitHub][github-star-badge]][github-star]
3838
[![Tweet][twitter-badge]][twitter]
39-
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)
39+
4040
<!-- prettier-ignore-end -->
4141

4242
<div align="center">
@@ -154,14 +154,14 @@ You may also be interested in installing `jest-dom` so you can use
154154
> We're in the process of moving examples to the
155155
> [docs site](https://testing-library.com/docs/example-codesandbox)
156156
157-
158157
You can also find svelte-testing-library examples at
159158
[react-testing-examples.com](https://react-testing-examples.com/jest-rtl/).
160159

161-
162160
## Other Solutions
163161

164-
There's currently a package published in npm called `svelte-testing-library` but the git repository is not yet public. We are hoping to pull that work (and name) into this repository.
162+
There's currently a package published in npm called `svelte-testing-library` but
163+
the git repository is not yet public. We are hoping to pull that work (and name)
164+
into this repository.
165165

166166
## Guiding Principles
167167

@@ -178,7 +178,7 @@ principles:
178178
component instances, nor should it encourage dealing with component
179179
instances.
180180
2. It should be generally useful for testing individual Svelte components or
181-
full Svelte applications.
181+
full Svelte applications.
182182
3. Utility implementations and APIs should be simple and flexible.
183183

184184
At the end of the day, what we want is for this library to be pretty
@@ -188,16 +188,14 @@ light-weight, simple, and understandable.
188188

189189
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
190190
<!-- prettier-ignore -->
191-
192191
<table><tr><td align="center"><a href="https://github.com/benmonro"><img src="https://avatars3.githubusercontent.com/u/399236?v=4" width="100px;" alt="Ben Monro"/><br /><sub><b>Ben Monro</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Tests">⚠️</a> <a href="#ideas-benmonro" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=benmonro" title="Documentation">📖</a></td><td align="center"><a href="https://twitter.com/EmilTholin"><img src="https://avatars0.githubusercontent.com/u/11573167?v=4" width="100px;" alt="Emil Tholin"/><br /><sub><b>Emil Tholin</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Code">💻</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=EmilTholin" title="Tests">⚠️</a> <a href="#ideas-EmilTholin" title="Ideas, Planning, & Feedback">🤔</a></td><td align="center"><a href="http://timdeschryver.dev"><img src="https://avatars1.githubusercontent.com/u/28659384?v=4" width="100px;" alt="Tim Deschryver"/><br /><sub><b>Tim Deschryver</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=timdeschryver" title="Documentation">📖</a></td><td align="center"><a href="https://medium.com/@oieduardorabelo"><img src="https://avatars1.githubusercontent.com/u/829902?v=4" width="100px;" alt="Eduardo Rabelo"/><br /><sub><b>Eduardo Rabelo</b></sub></a><br /><a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Tests">⚠️</a> <a href="https://github.com/testing-library/svelte-testing-library/commits?author=oieduardorabelo" title="Code">💻</a></td></tr></table>
193192

194-
195193
<!-- ALL-CONTRIBUTORS-LIST:END -->
194+
196195
Thanks goes to these people ([emoji key][emojis]):
197196

198197
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
199198
<!-- prettier-ignore -->
200-
201199
<!-- ALL-CONTRIBUTORS-LIST:END -->
202200

203201
This project follows the [all-contributors][all-contributors] specification.
@@ -279,5 +277,3 @@ Links:
279277
[stackoverflow]: https://stackoverflow.com/questions/tagged/svelte-testing-library
280278

281279
<!-- prettier-ignore-end -->
282-
283-

tests/render.spec.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ describe('render', () => {
6666
expect(getByTestId('custom-target')).toBeInTheDocument()
6767
})
6868

69-
test('after each test above, document is clean from targets and components', () => {
69+
test('after cleanup, document is clean from targets and components', () => {
70+
const {getByText} = render(App, {props: {name: 'world'}})
71+
72+
expect(getByText('Hello world!')).toBeInTheDocument()
73+
cleanup()
74+
7075
expect(document.body.innerHTML).toBe('')
7176
})
7277
})

0 commit comments

Comments
 (0)