Skip to content

Commit 7f537ef

Browse files
committed
docs: add section on TransitionStub and TransitionGroupStub
1 parent 7962b88 commit 7f537ef

File tree

5 files changed

+76
-1
lines changed

5 files changed

+76
-1
lines changed

docs/en/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
`vue-test-utils` is the official unit testing utility library for Vue.js.
44

5+
## Table of Contents
6+
57
* [Guides](guides/README.md)
68
* [Getting Started](guides/getting-started.md)
79
* [Common Tips](guides/common-tips.md)
8-
* [Mouse, Key and other DOM Events](guides/dom-events.md)
10+
* [Mouse, Key and other DOM Events](guides/dom-events.md)
911
* [Choosing a test runner](guides/choosing-a-test-runner.md)
1012
* [Testing SFCs with Jest](guides/testing-SFCs-with-jest.md)
1113
* [Testing SFCs with Mocha + webpack](guides/testing-SFCs-with-mocha-webpack.md)
@@ -46,6 +48,7 @@
4648
* [text](api/wrapper/text.md)
4749
* [trigger](api/wrapper/trigger.md)
4850
* [update](api/wrapper/update.md)
51+
* [destroy](api/wrapper/destroy.md)
4952
* [WrapperArray](api/wrapper-array/README.md)
5053
* [at](api/wrapper-array/at.md)
5154
* [contains](api/wrapper-array/contains.md)
@@ -62,5 +65,9 @@
6265
* [setProps](api/wrapper-array/setProps.md)
6366
* [trigger](api/wrapper-array/trigger.md)
6467
* [update](api/wrapper-array/update.md)
68+
* [destroy](api/wrapper-array/destroy.md)
69+
* [components](api/components/README.md)
70+
* [TransitionStub](api/components/TransitionStub.md)
71+
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
6572
* [Selectors](api/selectors.md)
6673
* [createLocalVue](api/createLocalVue.md)

docs/en/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,8 @@
6262
* [trigger](api/wrapper-array/trigger.md)
6363
* [update](api/wrapper-array/update.md)
6464
* [destroy](api/wrapper-array/destroy.md)
65+
* [components](api/components/README.md)
66+
* [TransitionStub](api/components/TransitionStub.md)
67+
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
6568
* [Selectors](api/selectors.md)
6669
* [createLocalVue](api/createLocalVue.md)

docs/en/api/components/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Components
2+
3+
vue-test-utils includes utility components you can use to stub components.
4+
5+
[TransitionStub](./TransitionStub.md) and [TransitionGroupStub](./TransitionGroupStub.md) are used to stub `transition` and `transition-group` components by default. You can edit the stubs by editing the config.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# TransitionGroupStub
2+
3+
A component to stub the `transition-group` wrapper component. Instead of performing transitions asynchronously, it returns the child components synchronously.
4+
5+
This is set to stub all `transition-group` components by default in the vue-test-utils config. To use the built-in `transition-group` wrapper component set `config.stubs[transition-group]` to false:
6+
7+
```js
8+
import VueTestUtils from 'vue-test-utils'
9+
10+
VueTestUtils.config.stubs.transition = false
11+
```
12+
13+
To reset it to stub transition components:
14+
```js
15+
import VueTestUtils, { TransitionGroupStub } from 'vue-test-utils'
16+
17+
VueTestUtils.config.stubs['transition-group'] = TransitionGroupStub
18+
```
19+
20+
To set it as a stub in mounting options:
21+
22+
```js
23+
import { mount, TransitionGroupStub } from 'vue-test-utils'
24+
25+
mount(Component, {
26+
stubs: {
27+
'transition-group': TransitionGroupStub
28+
}
29+
})
30+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# TransitionStub
2+
3+
A component to stub the `transition` wrapper component. Instead of performing transitions asynchronously, it returns the child component synchronously.
4+
5+
This is set to stub all `transition` components by default in the vue-test-utils config. To use the built-in `transition` wrapper component set `config.stubs.transition` to false:
6+
7+
```js
8+
import VueTestUtils from 'vue-test-utils'
9+
10+
VueTestUtils.config.stubs.transition = false
11+
```
12+
13+
To reset it to stub transition components:
14+
```js
15+
import VueTestUtils, { TransitionStub } from 'vue-test-utils'
16+
17+
VueTestUtils.config.stubs.transition = TransitionStub
18+
```
19+
20+
To set it as a stub in mounting options:
21+
22+
```js
23+
import { mount, TransitionStub } from 'vue-test-utils'
24+
25+
mount(Component, {
26+
stubs: {
27+
transition: TransitionStub
28+
}
29+
})
30+
```

0 commit comments

Comments
 (0)