Skip to content

Commit

Permalink
feat: added container to the API (#24)
Browse files Browse the repository at this point in the history
* feat: added container to the API
- added example
- added test
- bumped library to fix low vulnerability

* Update README.md

Co-Authored-By: Ben Monro <[email protected]>

* Update README.md

Co-Authored-By: Ben Monro <[email protected]>
  • Loading branch information
ematipico and benmonro committed May 18, 2019
1 parent 5704d92 commit 55cde29
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"jest": "^24.7.1",
"jest-dom": "^3.1.2",
"jest-transform-svelte": "^1.0.0",
"kcd-scripts": "^1.2.1",
"kcd-scripts": "^1.4.0",
"npm-run-all": "^4.1.5",
"rollup": "^1.10.1",
"rollup-plugin-commonjs": "^9.3.4",
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const render = (Component, {target, ...options} = {}) => {
component,
// eslint-disable-next-line no-console
debug: (el = document.body) => console.log(prettyDOM(el)),
container: document.body,
...getQueriesForElement(document.body),
}
}
Expand Down
8 changes: 8 additions & 0 deletions tests/render.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,12 @@ describe('render', () => {

expect(document.body.innerHTML).toBe('')
})

test('should return a container object, which contains the DOM of the rendered component', () => {
const {container} = render(App, {props: {name: 'world'}})

expect(container.innerHTML).toBe(document.body.innerHTML)

cleanup()
})
})

0 comments on commit 55cde29

Please sign in to comment.