Skip to content

Commit bd3e9b4

Browse files
committed
Use new "bindElementToQueries" method from dom-testing-library
1 parent a297d77 commit bd3e9b4

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

package-lock.json

Lines changed: 12 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"license": "MIT",
2929
"dependencies": {
3030
"@vue/test-utils": "^1.0.0-beta.13",
31-
"dom-testing-library": "^1.4.0",
31+
"dom-testing-library": "^1.6.1",
3232
"vue": "^2.5.16",
3333
"vue-template-compiler": "^2.5.16"
3434
},

src/index.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createLocalVue, mount } from '@vue/test-utils'
22
import Simulate from './Simulate'
3-
import { wait, queries } from 'dom-testing-library'
3+
import { bindElementToQueries, fireEvent, wait } from 'dom-testing-library'
44

55
function render (TestComponent, { props = null, store = null, routes = null } = {}, configurationCb) {
66
const localVue = createLocalVue()
@@ -31,13 +31,7 @@ function render (TestComponent, { props = null, store = null, routes = null } =
3131
attachToDocument: true
3232
})
3333

34-
const wrapperHelpers = Object.entries(queries).reduce(
35-
(helpers, [key, fn]) => {
36-
helpers[key] = fn.bind(null, wrapper.element)
37-
return helpers
38-
},
39-
{}
40-
)
34+
const wrapperHelpers = bindElementToQueries(wrapper.element)
4135

4236
return {
4337
unmount: () => wrapper.destroy(),
@@ -49,4 +43,4 @@ function render (TestComponent, { props = null, store = null, routes = null } =
4943
}
5044
}
5145

52-
export { render, wait, Simulate }
46+
export { render, wait, fireEvent, Simulate }

0 commit comments

Comments
 (0)