Skip to content

Commit c84709e

Browse files
committed
Support for Vue plugins
1 parent baf57eb commit c84709e

39 files changed

+94
-14
lines changed

package-lock.json

Lines changed: 6 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"jest": "^22.4.2",
3232
"jest-in-case": "^1.0.2",
3333
"jest-serializer-vue": "^1.0.0",
34+
"vee-validate": "^2.0.6",
3435
"vue-jest": "^2.2.1"
3536
},
3637
"jest": {
@@ -45,7 +46,7 @@
4546
"testPathIgnorePatterns": [
4647
"/node_modules/",
4748
"<rootDir>/npm/",
48-
"<rootDir>/src/__tests__/components/"
49+
"<rootDir>/tests/__tests__/components/"
4950
],
5051
"transform": {
5152
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",

src/Simulate.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ const simulate = (event, elem, ...params) => {
1313
const click = simulate.bind(null, 'click')
1414
const submit = simulate.bind(null, 'submit')
1515
const change = simulate.bind(null, 'change')
16+
const focus = simulate.bind(null, 'focus')
17+
const blur = simulate.bind(null, 'blur')
1618

1719
export default {
1820
click,
1921
submit,
20-
change
22+
change,
23+
focus,
24+
blur
2125
}

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import waitForExpect from 'wait-for-expect'
55
import Simulate from './Simulate'
66
import * as queries from './queries'
77

8-
function render(TestComponent, { props = null, store = null, routes = null } = {}) {
8+
function render(TestComponent, { props = null, store = null, routes = null } = {}, configurationCb) {
99
const localVue = createLocalVue()
1010
let vuexStore = null
1111
let router = null
@@ -20,6 +20,10 @@ function render(TestComponent, { props = null, store = null, routes = null } = {
2020
router = new VueRouter(routes)
2121
}
2222

23+
if (configurationCb && typeof configurationCb === 'function') {
24+
configurationCb(localVue)
25+
}
26+
2327
const wrapper = mount(TestComponent, {
2428
localVue,
2529
router,
File renamed without changes.

src/__tests__/components/Login.vue renamed to tests/__tests__/components/Login.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
<div>
33
<form @submit.prevent="submit">
44
<label for="username-input">Username</label>
5-
<input v-model="username" id="username-input" placeholder="Username..." name="username" />
5+
<input
6+
id="username-input"
7+
v-model="username"
8+
placeholder="Username..."
9+
name="username" />
610
<label id="password-label">Password</label>
711
<input
812
v-model="password"

0 commit comments

Comments
 (0)