Skip to content

Commit 1920f4b

Browse files
committed
Last changes added
Signed-off-by: Bruno Lesieur <[email protected]>
1 parent 4f6a89f commit 1920f4b

27 files changed

+285
-70
lines changed

docs/fr/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
`vue-test-utils` est la bibliothèque officielle de tests unitaires pour Vue.js.
44

5+
## Table of Contents
6+
57
* [Guides](guides/README.md)
68
* [Commencer](guides/getting-started.md)
79
* [Astuces](guides/common-tips.md)
@@ -39,12 +41,14 @@
3941
* [isEmpty](api/wrapper/isEmpty.md)
4042
* [isVueInstance](api/wrapper/isVueInstance.md)
4143
* [name](api/wrapper/name.md)
44+
* [setComputed](api/wrapper/setComputed.md)
4245
* [setData](api/wrapper/setData.md)
4346
* [setMethods](api/wrapper/setMethods.md)
4447
* [setProps](api/wrapper/setProps.md)
4548
* [text](api/wrapper/text.md)
4649
* [trigger](api/wrapper/trigger.md)
4750
* [update](api/wrapper/update.md)
51+
* [destroy](api/wrapper/destroy.md)
4852
* [WrapperArray](api/wrapper-array/README.md)
4953
* [at](api/wrapper-array/at.md)
5054
* [contains](api/wrapper-array/contains.md)
@@ -55,10 +59,16 @@
5559
* [is](api/wrapper-array/is.md)
5660
* [isEmpty](api/wrapper-array/isEmpty.md)
5761
* [isVueInstance](api/wrapper-array/isVueInstance.md)
62+
* [setComputed](api/wrapper-array/setComputed.md)
5863
* [setData](api/wrapper-array/setData.md)
5964
* [setMethods](api/wrapper-array/setMethods.md)
6065
* [setProps](api/wrapper-array/setProps.md)
6166
* [trigger](api/wrapper-array/trigger.md)
6267
* [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)
6372
* [Selecteurs](api/selectors.md)
6473
* [createLocalVue](api/createLocalVue.md)
74+
* [config](api/config.md)

docs/fr/SUMMARY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* [isEmpty](api/wrapper/isEmpty.md)
3838
* [isVueInstance](api/wrapper/isVueInstance.md)
3939
* [name](api/wrapper/name.md)
40+
* [setComputed](api/wrapper/setComputed.md)
4041
* [setData](api/wrapper/setData.md)
4142
* [setMethods](api/wrapper/setMethods.md)
4243
* [setProps](api/wrapper/setProps.md)
@@ -54,11 +55,16 @@
5455
* [is](api/wrapper-array/is.md)
5556
* [isEmpty](api/wrapper-array/isEmpty.md)
5657
* [isVueInstance](api/wrapper-array/isVueInstance.md)
58+
* [setComputed](api/wrapper-array/setComputed.md)
5759
* [setData](api/wrapper-array/setData.md)
5860
* [setMethods](api/wrapper-array/setMethods.md)
5961
* [setProps](api/wrapper-array/setProps.md)
6062
* [trigger](api/wrapper-array/trigger.md)
6163
* [update](api/wrapper-array/update.md)
6264
* [destroy](api/wrapper-array/destroy.md)
65+
* [components](api/components/README.md)
66+
* [TransitionStub](api/components/TransitionStub.md)
67+
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
6368
* [Selectors](api/selectors.md)
6469
* [createLocalVue](api/createLocalVue.md)
70+
* [config](api/config.md)

docs/fr/api/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* [emitted (EN)](./wrapper/emitted.md)
1818
* [emittedByOrder (EN)](./wrapper/emittedByOrder.md)
1919
* [find (EN)](./wrapper/find.md)
20+
* [findAll (EN)](./wrapper/findAll.md)
2021
* [hasAttribute (EN)](./wrapper/hasAttribute.md)
2122
* [hasClass (EN)](./wrapper/hasClass.md)
2223
* [hasProp (EN)](./wrapper/hasProp.md)
@@ -26,11 +27,14 @@
2627
* [isEmpty (EN)](./wrapper/isEmpty.md)
2728
* [isVueInstance (EN)](./wrapper/isVueInstance.md)
2829
* [name (EN)](./wrapper/name.md)
29-
* [update (EN)](./wrapper/update.md)
30-
* [setData (EN)](./wrapper/setData.md)
31-
* [setProps (EN)](./wrapper/setProps.md)
32-
* [text (EN)](./wrapper/text.md)
30+
* [setComputed](./wrapper/setComputed.md)
31+
* [setData](./wrapper/setData.md)
32+
* [setMethods](./wrapper/setMethods.md)
33+
* [setProps](./wrapper/setProps.md)
34+
* [text](./wrapper/text.md)
3335
* [trigger (EN)](./wrapper/trigger.md)
36+
* [update (EN)](./wrapper/update.md)
37+
* [destroy (EN)](./wrapper/destroy.md)
3438
* [WrapperArray (EN)](./wrapper-array/README.md)
3539
* [at (EN)](./wrapper-array/at.md)
3640
* [contains (EN)](./wrapper-array/contains.md)
@@ -41,9 +45,16 @@
4145
* [is (EN)](./wrapper-array/is.md)
4246
* [isEmpty (EN)](./wrapper-array/isEmpty.md)
4347
* [isVueInstance (EN)](./wrapper-array/isVueInstance.md)
44-
* [update (EN)](./wrapper-array/update.md)
48+
* [setComputed (EN)](./wrapper-array/setComputed.md)
4549
* [setData (EN)](./wrapper-array/setData.md)
50+
* [setMethods (EN)](./wrapper-array/setMethods.md)
4651
* [setProps (EN)](./wrapper-array/setProps.md)
4752
* [trigger (EN)](./wrapper-array/trigger.md)
53+
* [update (EN)](./wrapper-array/update.md)
54+
* [destroy (EN)](./wrapper-array/destroy.md)
55+
* [components](./components/README.md)
56+
* [TransitionStub](./components/TransitionStub.md)
57+
* [TransitionGroupStub](./components/TransitionGroupStub.md)
4858
* [createLocalVue (EN)](./createLocalVue.md)
4959
* [Selecteurs (EN)](./selectors.md)
60+
* [config (EN)](./config.md)

docs/fr/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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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-group'] = false
11+
```
12+
13+
To reset it to stub transition components:
14+
15+
```js
16+
import VueTestUtils, { TransitionGroupStub } from 'vue-test-utils'
17+
18+
VueTestUtils.config.stubs['transition-group'] = TransitionGroupStub
19+
```
20+
21+
To set it as a stub in mounting options:
22+
23+
```js
24+
import { mount, TransitionGroupStub } from 'vue-test-utils'
25+
26+
mount(Component, {
27+
stubs: {
28+
'transition-group': TransitionGroupStub
29+
}
30+
})
31+
```
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+
```

docs/fr/api/config.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Config
2+
3+
vue-test-utils includes a config object to defined options used by vue-test-utils.
4+
5+
## `vue-test-utils` Config Options
6+
7+
### `stubs`
8+
9+
- type: `Object`
10+
- default: `{
11+
transition: TransitionStub,
12+
'transition-group': TransitionGroupStub
13+
}`
14+
15+
Stubs to use in components. These are overwritten by `stubs` passed in the mounting options.
16+
17+
When passing `stubs` as an array in the mounting options, `config.stubs` are converted to an array, and will stub components with a basic component that returns a div.
18+
19+
Example:
20+
21+
```js
22+
import VueTestUtils from 'vue-test-utils'
23+
24+
VueTestUtils.config.stubs['my-compomnent'] = '<div />'
25+
```

docs/fr/api/createLocalVue.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# createLocalVue()
1+
# `createLocalVue()`
22

33
- **Returns:**
44
- `{Component}`
@@ -7,7 +7,7 @@
77

88
<p><strong>⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou <a href="https://github.com/vuejs-fr/vue-test-utils" target="_blank">participer à la traduction</a> de celle-ci dès maintenant !</strong></p><p>`createLocalVue` returns a Vue class for you to add components, mixins and install plugins without polluting the global Vue class.</p>
99

10-
Use it with `options.localVue`
10+
Use it with `options.localVue`:
1111

1212
```js
1313
import { createLocalVue, shallow } from 'vue-test-utils'

docs/fr/api/mount.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# mount(component {, options}])
1+
# `mount(component {, options}])`
22

33
- **Arguments:**
44

@@ -31,6 +31,7 @@ describe('Foo', () => {
3131
})
3232
})
3333
```
34+
3435
**With Vue options:**
3536

3637
```js
@@ -80,7 +81,7 @@ describe('Foo', () => {
8081
const wrapper = mount(Foo, {
8182
slots: {
8283
default: [Bar, FooBar],
83-
fooBar: FooBar, // Will match <slot name="FooBar" />,
84+
fooBar: FooBar, // Will match `<slot name="FooBar" />`.
8485
foo: '<div />'
8586
}
8687
})

docs/fr/api/options.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Vue options are passed to the component when a new instance is created. , e.g. `
66

77
## `vue-test-utils` Specific Mounting Options
88

9-
- [context](#context)
10-
- [slots](#slots)
11-
- [stubs](#stubs)
12-
- [mocks](#mocks)
13-
- [localVue](#localvue)
14-
- [attachToDocument](#attachtodocument)
15-
- [attrs](#attrs)
16-
- [listeners](#listeners)
17-
- [clone](#clone)
9+
- [`context`](#context)
10+
- [`slots`](#slots)
11+
- [`stubs`](#stubs)
12+
- [`mocks`](#mocks)
13+
- [`localVue`](#localvue)
14+
- [`attachToDocument`](#attachtodocument)
15+
- [`attrs`](#attrs)
16+
- [`listeners`](#listeners)
17+
- [`clone`](#clone)
1818

1919
### `context`
2020

@@ -50,7 +50,7 @@ import Bar from './Bar.vue'
5050
const wrapper = shallow(Component, {
5151
slots: {
5252
default: [Foo, Bar],
53-
fooBar: Foo, // Will match <slot name="FooBar" />,
53+
fooBar: Foo, // Will match `<slot name="FooBar" />`.
5454
foo: '<div />'
5555
}
5656
})
@@ -106,7 +106,7 @@ expect(wrapper.vm.$route.path).toBe($route.path)
106106

107107
- type: `Vue`
108108

109-
A local copy of Vue created by [createLocalVue](./createLocalVue.md) to use when mounting the component. Installing plugins on this copy of Vue prevents polluting the original `Vue` copy.
109+
A local copy of Vue created by [`createLocalVue`](./createLocalVue.md) to use when mounting the component. Installing plugins on this copy of `Vue` prevents polluting the original `Vue` copy.
110110

111111
Example:
112112

@@ -162,4 +162,4 @@ Clones component before mounting if `true`, which avoids mutating the original c
162162

163163
`options.mocks` (`Object`): Add globals to Vue instance.
164164

165-
`options.localVue` (`Object`): vue class to use in `mount`. See [createLocalVue](createLocalVue.md)
165+
`options.localVue` (`Object`): `Vue` class to use in `mount`. See [`createLocalVue`](createLocalVue.md).

docs/fr/api/selectors.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
# Selectors
22

3-
<p><strong>⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou <a href="https://github.com/vuejs-fr/vue-test-utils" target="_blank">participer à la traduction</a> de celle-ci dès maintenant !</strong></p><p>A lot of methods take a selector as an argument. A selector can either be a CSS selector, or a Vue component.</p>
3+
<p><strong>⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou <a href="https://github.com/vuejs-fr/vue-test-utils" target="_blank">participer à la traduction</a> de celle-ci dès maintenant !</strong></p><p>A lot of methods take a selector as an argument. A selector can either be a CSS selector, a Vue component, or a find option object.</p>
44

55
## CSS Selectors
66

7-
mount handles any valid CSS selector:
7+
Mount handles any valid CSS selector:
88

9-
- tag selectors (div, foo, bar)
10-
- class selectors (.foo, .bar)
11-
- attribute selectors ([foo], [foo="bar"])
12-
- id selectors (#foo, #bar)
13-
- pseudo selectors (div:first-of-type)
9+
- tag selectors (`div`, `foo`, `bar`)
10+
- class selectors (`.foo`, `.bar`)
11+
- attribute selectors (`[foo]`, `[foo="bar"]`)
12+
- id selectors (`#foo`, `#bar`)
13+
- pseudo selectors (`div:first-of-type`)
1414

1515
You can also use combinators:
1616

17-
- direct descendant combinator (div > #bar > .foo)
18-
- general descendant combinator (div #bar .foo)
19-
- adjacent sibling selector (div + .foo)
20-
- general sibling selector (div ~ .foo)
17+
- direct descendant combinator (`div > #bar > .foo`)
18+
- general descendant combinator (`div #bar .foo`)
19+
- adjacent sibling selector (`div + .foo`)
20+
- general sibling selector (`div ~ .foo`)
2121

2222
## Vue Components
2323

2424
Vue components are also valid selectors.
2525

26-
vue-test-utils uses the `name` property to search the instance tree for matching Vue components.
26+
`vue-test-utils` uses the `name` property to search the instance tree for matching Vue components.
2727

2828
```js
2929
// Foo.vue
3030

31-
export default{
31+
export default {
3232
name: 'FooComponent'
3333
}
3434
```
@@ -41,3 +41,14 @@ import Foo from './Foo.vue'
4141
const wrapper = shallow(Foo)
4242
expect(wrapper.is(Foo)).toBe(true)
4343
```
44+
45+
## Find Option Object
46+
47+
### Ref
48+
49+
Using a find option object, `vue-test-utils` allows for selecting elements by `$ref` on wrapper components.
50+
51+
```js
52+
const buttonWrapper = wrapper.find({ ref: 'myButton' });
53+
buttonWrapper.trigger('click');
54+
```

docs/fr/api/shallow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# shallow(component {, options}])
1+
# `shallow(component {, options}])`
22

33
- **Arguments:**
44

docs/fr/api/wrapper-array/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# WrapperArray
22

3-
<p><strong>⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou <a href="https://github.com/vuejs-fr/vue-test-utils" target="_blank">participer à la traduction</a> de celle-ci dès maintenant !</strong></p><p>A `WrapperArray` is an object that contains an array of [Wrappers](../wrapper/README.md), and methods to test the `Wrappers`.</p>
3+
<p><strong>⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou <a href="https://github.com/vuejs-fr/vue-test-utils" target="_blank">participer à la traduction</a> de celle-ci dès maintenant !</strong></p><p>A `WrapperArray` is an object that contains an array of [`Wrappers`](../wrapper/README.md), and methods to test the `Wrappers`.</p>
44

55
- **Properties:**
66

77
`length` `number`: the number of `Wrappers` contained in the `WrapperArray`
88

99
- **Methods:**
1010

11-
There is a detailed list of methods in the WrapperArray section of the docs.
11+
There is a detailed list of methods in the `WrapperArray` section of the docs.

docs/fr/api/wrapper-array/destroy.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ const divArray = wrapper.findAll('div')
1414
expect(divArray.contains('p')).toBe(true)
1515
divArray.destroy()
1616
expect(divArray.contains('p')).toBe(false)
17-
1817
```

0 commit comments

Comments
 (0)