Skip to content

Commit b9b0aa9

Browse files
committed
refactor: rename intercept to mocks
1 parent f6bc715 commit b9b0aa9

File tree

14 files changed

+33
-29
lines changed

14 files changed

+33
-29
lines changed

docs/.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
"globals": {
1010
"mount": true,
1111
"shallow": true,
12-
"Component": true
12+
"Component": true,
13+
"MyPlugin": true
14+
},
15+
"rules": {
16+
"no-unused-vars": 0
1317
}
1418
}

docs/en/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- [context](api/options.md#context)
1515
- [slots](api/options.md#slots)
1616
- [stubs](api/options.md#stubs)
17-
- [intercept](api/options.md#intercept)
17+
- [mocks](api/options.md#mocks)
1818
- [localVue](api/options.md#localvue)
1919
- [attachToDocument](api/options.md#attachtodocument)
2020
- [attrs](api/options.md#attrs)

docs/en/api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- [context](./options.md#context)
77
- [slots](./options.md#slots)
88
- [stubs](./options.md#stubs)
9-
- [intercept](./options.md#intercept)
9+
- [mocks](./options.md#mocks)
1010
- [localVue](./options.md#localvue)
1111
- [attachToDocument](./options.md#attachtodocument)
1212
- [attrs](./options.md#attrs)

docs/en/api/createLocalVue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Foo from './Foo.vue'
1717
const localVue = createLocalVue()
1818
const wrapper = shallow(Foo, {
1919
localVue,
20-
intercept: { foo: true }
20+
mocks: { foo: true }
2121
})
2222
expect(wrapper.vm.foo).to.equal(true)
2323

docs/en/api/mount.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('Foo', () => {
100100
it('renders a div', () => {
101101
const $route = { path: 'http://www.example-path.com' }
102102
const wrapper = mount(Foo, {
103-
intercept: {
103+
mocks: {
104104
$route
105105
}
106106
})

docs/en/api/options.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Vue options are passed to the component when a new instance is created. , e.g. `
99
- [context](#context)
1010
- [slots](#slots)
1111
- [stubs](#stubs)
12-
- [intercept](#intercept)
12+
- [mocks](#mocks)
1313
- [localVue](#localvue)
1414
- [attachToDocument](#attachtodocument)
1515
- [attrs](#attrs)
@@ -82,7 +82,7 @@ shallow(Component, {
8282
})
8383
```
8484

85-
### `intercept`
85+
### `mocks`
8686

8787
- type: `Object`
8888

@@ -95,7 +95,7 @@ import { expect } from 'chai'
9595

9696
const $route = { path: 'http://www.example-path.com' }
9797
const wrapper = shallow(Component, {
98-
intercept: {
98+
mocks: {
9999
$route
100100
}
101101
})
@@ -160,6 +160,6 @@ Set the component instance's `$listeners` object.
160160

161161
Clones component before mounting if `true`, which avoids mutating the original component definition.
162162

163-
`options.intercept` (`Object`): Add globals to Vue instance.
163+
`options.mocks` (`Object`): Add globals to Vue instance.
164164

165165
`options.localVue` (`Object`): vue class to use in `mount`. See [createLocalVue](createLocalVue.md)

docs/en/api/shallow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- `{Object} slots`
1010
- `{Array<Componet|Object>|Component|String} default`
1111
- `{Array<Componet|Object>|Component|String} named`
12-
- `{Object} intercept`
12+
- `{Object} mocks`
1313
- `{Object|Array<string>} stubs`
1414
- `{boolean} clone`
1515
- `{Object} children`
@@ -114,7 +114,7 @@ describe('Foo', () => {
114114
it('renders a div', () => {
115115
const $route = { path: 'http://www.example-path.com' }
116116
const wrapper = shallow(Foo, {
117-
intercept: {
117+
mocks: {
118118
$route
119119
}
120120
})

flow/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare type Options = { // eslint-disable-line no-undef
22
attachToDocument?: boolean,
3-
intercept?: Object,
3+
mocks?: Object,
44
slots?: Object,
55
localVue?: Component,
66
stubs?: Object,

src/lib/add-intercepts.js

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

src/lib/add-mocks.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @flow
2+
3+
export default function addMocks (mockedProperties: Object, Vue: Component) {
4+
Object.keys(mockedProperties).forEach((key) => {
5+
Vue.prototype[key] = mockedProperties[key]
6+
})
7+
}

0 commit comments

Comments
 (0)