diff --git a/.all-contributorsrc b/.all-contributorsrc
index 06802e81..1c181443 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -360,6 +360,16 @@
"contributions": [
"doc"
]
+ },
+ {
+ "login": "ehteshamkafeel",
+ "name": "Ehtesham Kafeel",
+ "avatar_url": "https://avatars1.githubusercontent.com/u/1213123?v=4",
+ "profile": "https://github.com/ehteshamkafeel",
+ "contributions": [
+ "code",
+ "doc"
+ ]
}
]
}
diff --git a/README.md b/README.md
index 7f66cc63..56fc3256 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
[![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends]
[![MIT License][license-badge]][license]
-[](#contributors)
+[](#contributors)
[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc]
[![Join the community on Spectrum][spectrum-badge]][spectrum]
@@ -215,6 +215,19 @@ The containing DOM node of your rendered React Element (rendered using
> `container.firstChild` will only get the first child of that Fragment, not the
> Fragment itself.
+#### `baseElement`
+
+The containing DOM node where your React Element is rendered in the container.
+If you don't specify the `baseElement` in the options of `render`, it will
+default to `documentElement`.
+
+This is useful when the component you want to test renders something outside the
+container div, e.g. when you want to snapshot test your portal component which
+renders it's HTML directly in the body.
+
+> Note: the queries returned by the `render` looks into baseElement, so you can
+> use queries to test your portal component without the baseElement.
+
#### `debug`
This method is a shortcut for `console.log(prettyDOM(container))`.
@@ -946,7 +959,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [
Michal Baranowski](https://twitter.com/baranovskim)
[π](#blog-mbaranovski "Blogposts") [β
](#tutorial-mbaranovski "Tutorials") | [
Arthur Puthin](https://github.com/aputhin)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=aputhin "Documentation") | [
Thomas Chia](https://github.com/thchia)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=thchia "Documentation") | [
Thiago Galvani](http://ilegra.com/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=thiagopaiva99 "Documentation") | [
Christian](http://Chriswcs.github.io)
[β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=ChrisWcs "Tests") | [
Alex Krolick](https://alexkrolick.com)
[π¬](#question-alexkrolick "Answering Questions") [π](https://github.com/kentcdodds/react-testing-library/commits?author=alexkrolick "Documentation") [π‘](#example-alexkrolick "Examples") [π€](#ideas-alexkrolick "Ideas, Planning, & Feedback") | [
Johann Hubert Sonntagbauer](https://github.com/johann-sonntagbauer)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=johann-sonntagbauer "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=johann-sonntagbauer "Documentation") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=johann-sonntagbauer "Tests") |
| [
Maddi Joyce](http://www.maddijoyce.com)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=maddijoyce "Code") | [
Ryan Vice](http://www.vicesoftware.com)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=RyanAtViceSoftware "Documentation") | [
Ian Wilson](https://ianwilson.io)
[π](#blog-iwilsonq "Blogposts") [β
](#tutorial-iwilsonq "Tutorials") | [
Daniel](https://github.com/InExtremaRes)
[π](https://github.com/kentcdodds/react-testing-library/issues?q=author%3AInExtremaRes "Bug reports") [π»](https://github.com/kentcdodds/react-testing-library/commits?author=InExtremaRes "Code") | [
Giorgio Polvara](https://twitter.com/Gpx)
[π](https://github.com/kentcdodds/react-testing-library/issues?q=author%3AGpx "Bug reports") [π€](#ideas-Gpx "Ideas, Planning, & Feedback") | [
John Gozde](https://github.com/jgoz)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=jgoz "Code") | [
Sam Horton](https://twitter.com/SavePointSam)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=SavePointSam "Documentation") [π‘](#example-SavePointSam "Examples") [π€](#ideas-SavePointSam "Ideas, Planning, & Feedback") |
| [
Richard Kotze (mobile)](http://www.richardkotze.com)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=rkotze "Documentation") | [
Brahian E. Soto Mercedes](https://github.com/sotobuild)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=sotobuild "Documentation") | [
Benoit de La Forest](https://github.com/bdelaforest)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=bdelaforest "Documentation") | [
Salah](https://github.com/thesalah)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=thesalah "Code") [β οΈ](https://github.com/kentcdodds/react-testing-library/commits?author=thesalah "Tests") | [
Adam Gordon](http://gordonizer.com)
[π](https://github.com/kentcdodds/react-testing-library/issues?q=author%3Aicfantv "Bug reports") [π»](https://github.com/kentcdodds/react-testing-library/commits?author=icfantv "Code") | [
Matija MarohniΔ](https://silvenon.com)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=silvenon "Documentation") | [
Justice Mba](https://github.com/Dajust)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=Dajust "Documentation") |
-| [
Mark Pollmann](https://markpollmann.com/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=MarkPollmann "Documentation") |
+| [
Mark Pollmann](https://markpollmann.com/)
[π](https://github.com/kentcdodds/react-testing-library/commits?author=MarkPollmann "Documentation") | [
Ehtesham Kafeel](https://github.com/ehteshamkafeel)
[π»](https://github.com/kentcdodds/react-testing-library/commits?author=ehteshamkafeel "Code") [π](https://github.com/kentcdodds/react-testing-library/commits?author=ehteshamkafeel "Documentation") |
diff --git a/src/__tests__/render.js b/src/__tests__/render.js
index 066accd1..b5c09b90 100644
--- a/src/__tests__/render.js
+++ b/src/__tests__/render.js
@@ -1,21 +1,58 @@
+import 'jest-dom/extend-expect'
import React from 'react'
+import ReactDOM from 'react-dom'
import {render, cleanup} from '../'
afterEach(cleanup)
-it('renders button into document', () => {
+test('renders div into document', () => {
const ref = React.createRef()
const {container} = render(