Skip to content

Commit

Permalink
feat(queries): upgrade dom-testing-library to support all queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Apr 24, 2018
1 parent ecf4bba commit 40dfcde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)",
"license": "MIT",
"dependencies": {
"dom-testing-library": "^1.0.0",
"wait-for-expect": "0.4.0"
"dom-testing-library": "^1.10.0",
"wait-for-expect": "^0.5.0"
},
"devDependencies": {
"@types/react-dom": "^16.0.4",
"@types/react-dom": "^16.0.5",
"axios": "^0.18.0",
"history": "^4.7.2",
"jest-in-case": "^1.0.2",
"kcd-scripts": "^0.36.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"kcd-scripts": "^0.37.0",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-redux": "^5.0.7",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-transition-group": "^2.2.1",
"redux": "^3.7.2"
"react-transition-group": "^2.3.1",
"redux": "^4.0.0"
},
"peerDependencies": {
"react-dom": "*"
Expand Down
11 changes: 2 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import ReactDOM from 'react-dom'
import {Simulate} from 'react-dom/test-utils'
import {queries, wait, fireEvent} from 'dom-testing-library'
import {bindElementToQueries, wait, fireEvent} from 'dom-testing-library'

function render(ui, {container = document.createElement('div')} = {}) {
ReactDOM.render(ui, container)
const containerHelpers = Object.entries(queries).reduce(
(helpers, [key, fn]) => {
helpers[key] = fn.bind(null, container)
return helpers
},
{},
)
return {
container,
unmount: () => ReactDOM.unmountComponentAtNode(container),
...containerHelpers,
...bindElementToQueries(container),
}
}

Expand Down

0 comments on commit 40dfcde

Please sign in to comment.