Skip to content

Commit e07eb02

Browse files
committed
Move querying logic to dom-testing-library
1 parent 08f6d6f commit e07eb02

File tree

14 files changed

+23
-493
lines changed

14 files changed

+23
-493
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ It's primary guiding principle is:
2222

2323
The more your tests resemble the way your software is used, the more confidence they can give you.
2424

25-
The intention is to closely track react-test-utils and its capabilities. As such significant parts of its code are repeated here verbatim. All credit for this must go to Kent C Dodds and the other contributors to that project.
25+
The intention is to closely track react-test-utils and its capabilities. To this end it uses the marvellous `dom-testing-utils` library for querying the DOM.
26+
2627

2728
## Installation
2829

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
"author": "Daniel Cook",
2626
"license": "MIT",
2727
"dependencies": {
28+
"dom-testing-library": "^1.0.0",
2829
"@vue/test-utils": "^1.0.0-beta.12",
2930
"vue": "^2.5.16",
3031
"vue-router": "^3.0.1",
3132
"vue-template-compiler": "^2.5.16",
32-
"vuex": "^3.0.1",
33-
"wait-for-expect": "^0.4.0"
33+
"vuex": "^3.0.1"
3434
},
3535
"devDependencies": {
3636
"axios": "^0.18.0",

src/extend-expect.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { createLocalVue, mount, Wrapper } from '@vue/test-utils'
22
import Vuex from 'vuex'
33
import VueRouter from 'vue-router'
4-
import waitForExpect from 'wait-for-expect'
54
import Simulate from './Simulate'
6-
import * as queries from './queries'
5+
import { wait, queries } from 'dom-testing-library'
76

87
function render(TestComponent, { props = null, store = null, routes = null } = {}, configurationCb) {
98
const localVue = createLocalVue()
@@ -34,7 +33,7 @@ function render(TestComponent, { props = null, store = null, routes = null } = {
3433

3534
const wrapperHelpers = Object.entries(queries).reduce(
3635
(helpers, [key, fn]) => {
37-
helpers[key] = fn.bind(null, wrapper)
36+
helpers[key] = fn.bind(null, wrapper.element)
3837
return helpers
3938
},
4039
{},
@@ -50,8 +49,4 @@ function render(TestComponent, { props = null, store = null, routes = null } = {
5049
}
5150
}
5251

53-
function wait(callback = () => {}, {timeout = 4500, interval = 50} = {}) {
54-
return waitForExpect(callback, timeout, interval)
55-
}
56-
5752
export { render, wait, Simulate }

src/jest-extensions.js

Lines changed: 0 additions & 137 deletions
This file was deleted.

src/queries.js

Lines changed: 0 additions & 155 deletions
This file was deleted.

src/utils.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/__tests__/__snapshots__/element-queries.js.snap

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)