diff --git a/.all-contributorsrc b/.all-contributorsrc index 076f4205..de679507 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -698,6 +698,16 @@ "contributions": [ "doc" ] + }, + { + "login": "MarkFalconbridge", + "name": "MarkFalconbridge", + "avatar_url": "https://avatars1.githubusercontent.com/u/20678943?v=4", + "profile": "https://github.com/MarkFalconbridge", + "contributions": [ + "bug", + "code" + ] } ], "contributorsPerLine": 7 diff --git a/README.md b/README.md index 890fa52b..d6c46844 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ practices.

[![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] -[![All Contributors](https://img.shields.io/badge/all_contributors-71-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-72-orange.svg?style=flat-square)](#contributors) [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] [![Join the community on Spectrum][spectrum-badge]][spectrum] @@ -221,7 +221,7 @@ Thanks goes to these people ([emoji key][emojis]): | [Michiel Nuyts
Michiel Nuyts](https://github.com/Michielnuyts)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=Michielnuyts "Documentation") | [Joe Ng'ethe
Joe Ng'ethe](https://github.com/joeynimu)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=joeynimu "Code") [πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=joeynimu "Documentation") | [Kate
Kate](https://github.com/Enikol)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=Enikol "Documentation") | [Sean
Sean](http://www.seanrparker.com)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=SeanRParker "Documentation") | [James Long
James Long](http://jlongster.com)
[πŸ€”](#ideas-jlongster "Ideas, Planning, & Feedback") [πŸ“¦](#platform-jlongster "Packaging/porting to new platform") | [Herb Hagely
Herb Hagely](https://github.com/hhagely)
[πŸ’‘](#example-hhagely "Examples") | [Alex Wendte
Alex Wendte](http://www.wendtedesigns.com/)
[πŸ’‘](#example-themostcolm "Examples") | | [Monica Powell
Monica Powell](http://www.aboutmonica.com)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=M0nica "Documentation") | [Vitaly Sivkov
Vitaly Sivkov](http://sivkoff.com)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=sivkoff "Code") | [Weyert de Boer
Weyert de Boer](https://github.com/weyert)
[πŸ€”](#ideas-weyert "Ideas, Planning, & Feedback") [πŸ‘€](#review-weyert "Reviewed Pull Requests") | [EstebanMarin
EstebanMarin](https://github.com/EstebanMarin)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=EstebanMarin "Documentation") | [Victor Martins
Victor Martins](https://github.com/vctormb)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=vctormb "Documentation") | [Royston Shufflebotham
Royston Shufflebotham](https://github.com/RoystonS)
[πŸ›](https://github.com/kentcdodds/react-testing-library/issues?q=author%3ARoystonS "Bug reports") [πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=RoystonS "Documentation") [πŸ’‘](#example-RoystonS "Examples") | [chrbala
chrbala](https://github.com/chrbala)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=chrbala "Code") | | [Donavon West
Donavon West](http://donavon.com)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=donavon "Code") [πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=donavon "Documentation") [πŸ€”](#ideas-donavon "Ideas, Planning, & Feedback") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=donavon "Tests") | [Richard Maisano
Richard Maisano](https://github.com/maisano)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=maisano "Code") | [Marco Biedermann
Marco Biedermann](https://www.marcobiedermann.com)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=marcobiedermann "Code") [🚧](#maintenance-marcobiedermann "Maintenance") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=marcobiedermann "Tests") | [Alex Zherdev
Alex Zherdev](https://github.com/alexzherdev)
[πŸ›](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Aalexzherdev "Bug reports") [πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=alexzherdev "Code") | [AndrΓ© Matulionis dos Santos
AndrΓ© Matulionis dos Santos](https://twitter.com/Andrewmat)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=Andrewmat "Code") [πŸ’‘](#example-Andrewmat "Examples") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=Andrewmat "Tests") | [Daniel K.
Daniel K.](https://github.com/FredyC)
[πŸ›](https://github.com/kentcdodds/react-testing-library/issues?q=author%3AFredyC "Bug reports") [πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=FredyC "Code") [πŸ€”](#ideas-FredyC "Ideas, Planning, & Feedback") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=FredyC "Tests") | [mohamedmagdy17593
mohamedmagdy17593](https://github.com/mohamedmagdy17593)
[πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=mohamedmagdy17593 "Code") | -| [Loren ☺️
Loren ☺️](http://lorensr.me)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=lorensr "Documentation") | +| [Loren ☺️
Loren ☺️](http://lorensr.me)
[πŸ“–](https://github.com/kentcdodds/react-testing-library/commits?author=lorensr "Documentation") | [MarkFalconbridge
MarkFalconbridge](https://github.com/MarkFalconbridge)
[πŸ›](https://github.com/kentcdodds/react-testing-library/issues?q=author%3AMarkFalconbridge "Bug reports") [πŸ’»](https://github.com/kentcdodds/react-testing-library/commits?author=MarkFalconbridge "Code") | This project follows the [all-contributors][all-contributors] specification. diff --git a/src/__tests__/render.js b/src/__tests__/render.js index 0ffe1322..74adf5ea 100644 --- a/src/__tests__/render.js +++ b/src/__tests__/render.js @@ -57,14 +57,16 @@ test('returns baseElement which defaults to document.body', () => { it('cleansup document', () => { const spy = jest.fn() + const divId = 'my-div'; class Test extends React.Component { componentWillUnmount() { + expect(document.getElementById(divId)).toBeInTheDocument() spy() } render() { - return
+ return
} } diff --git a/src/index.js b/src/index.js index d2661920..c07bd000 100644 --- a/src/index.js +++ b/src/index.js @@ -78,10 +78,10 @@ function cleanup() { // maybe one day we'll expose this (perhaps even as a utility returned by render). // but let's wait until someone asks for it. function cleanupAtContainer(container) { + ReactDOM.unmountComponentAtNode(container) if (container.parentNode === document.body) { document.body.removeChild(container) } - ReactDOM.unmountComponentAtNode(container) mountedContainers.delete(container) }