Skip to content

[Doc FR]: Some update from EN version #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jan 2, 2018
Merged
6 changes: 4 additions & 2 deletions docs/fr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* [contains](api/wrapper/contains.md)
* [emitted](api/wrapper/emitted.md)
* [emittedByOrder](api/wrapper/emittedByOrder.md)
* [exists](api/wrapper/exists.md)
* [destroy](api/wrapper/destroy.md)
* [find](api/wrapper/find.md)
* [findAll](api/wrapper/findAll.md)
* [hasAttribute](api/wrapper/hasAttribute.md)
Expand All @@ -48,10 +50,11 @@
* [text](api/wrapper/text.md)
* [trigger](api/wrapper/trigger.md)
* [update](api/wrapper/update.md)
* [destroy](api/wrapper/destroy.md)
* [WrapperArray](api/wrapper-array/README.md)
* [at](api/wrapper-array/at.md)
* [contains](api/wrapper-array/contains.md)
* [exists](api/wrapper/exists.md)
* [destroy](api/wrapper-array/destroy.md)
* [hasAttribute](api/wrapper-array/hasAttribute.md)
* [hasClass](api/wrapper-array/hasClass.md)
* [hasProp](api/wrapper-array/hasProp.md)
Expand All @@ -65,7 +68,6 @@
* [setProps](api/wrapper-array/setProps.md)
* [trigger](api/wrapper-array/trigger.md)
* [update](api/wrapper-array/update.md)
* [destroy](api/wrapper-array/destroy.md)
* [components](api/components/README.md)
* [TransitionStub](api/components/TransitionStub.md)
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
Expand Down
6 changes: 4 additions & 2 deletions docs/fr/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* [contains](api/wrapper/contains.md)
* [emitted](api/wrapper/emitted.md)
* [emittedByOrder](api/wrapper/emittedByOrder.md)
* [exists](api/wrapper/exists.md)
* [destroy](api/wrapper/destroy.md)
* [find](api/wrapper/find.md)
* [findAll](api/wrapper/findAll.md)
* [hasAttribute](api/wrapper/hasAttribute.md)
Expand All @@ -44,10 +46,11 @@
* [text](api/wrapper/text.md)
* [trigger](api/wrapper/trigger.md)
* [update](api/wrapper/update.md)
* [destroy](api/wrapper/destroy.md)
* [WrapperArray](api/wrapper-array/README.md)
* [at](api/wrapper-array/at.md)
* [contains](api/wrapper-array/contains.md)
* [exists](api/wrapper/exists.md)
* [destroy](api/wrapper-array/destroy.md)
* [hasAttribute](api/wrapper-array/hasAttribute.md)
* [hasClass](api/wrapper-array/hasClass.md)
* [hasProp](api/wrapper-array/hasProp.md)
Expand All @@ -61,7 +64,6 @@
* [setProps](api/wrapper-array/setProps.md)
* [trigger](api/wrapper-array/trigger.md)
* [update](api/wrapper-array/update.md)
* [destroy](api/wrapper-array/destroy.md)
* [components](api/components/README.md)
* [TransitionStub](api/components/TransitionStub.md)
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
Expand Down
28 changes: 15 additions & 13 deletions docs/fr/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

* [mount (EN)](./mount.md)
* [shallow (EN)](./shallow.md)
* [Options de montage (EN)](./options.md)
* [Mounting Options (EN)](./options.md)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trad perdu ici

Copy link
Contributor Author

@MachinisteWeb MachinisteWeb Dec 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Volontaire, je traduirais quand la page sera traduite. Bien vu :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

- [context (EN)](./options.md#context)
- [slots (EN)](./options.md#slots)
- [stubs (EN)](./options.md#stubs)
Expand All @@ -16,6 +16,8 @@
* [contains (EN)](./wrapper/contains.md)
* [emitted (EN)](./wrapper/emitted.md)
* [emittedByOrder (EN)](./wrapper/emittedByOrder.md)
* [exists (EN)](./wrapper/exists.md)
* [destroy (EN)](./wrapper/destroy.md)
* [find (EN)](./wrapper/find.md)
* [findAll (EN)](./wrapper/findAll.md)
* [hasAttribute (EN)](./wrapper/hasAttribute.md)
Expand All @@ -27,17 +29,18 @@
* [isEmpty (EN)](./wrapper/isEmpty.md)
* [isVueInstance (EN)](./wrapper/isVueInstance.md)
* [name (EN)](./wrapper/name.md)
* [setComputed](./wrapper/setComputed.md)
* [setData](./wrapper/setData.md)
* [setMethods](./wrapper/setMethods.md)
* [setProps](./wrapper/setProps.md)
* [text](./wrapper/text.md)
* [setComputed (EN)](./wrapper/setComputed.md)
* [setData (EN)](./wrapper/setData.md)
* [setMethods (EN)](./wrapper/setMethods.md)
* [setProps (EN)](./wrapper/setProps.md)
* [text (EN)](./wrapper/text.md)
* [trigger (EN)](./wrapper/trigger.md)
* [update (EN)](./wrapper/update.md)
* [destroy (EN)](./wrapper/destroy.md)
* [WrapperArray (EN)](./wrapper-array/README.md)
* [at (EN)](./wrapper-array/at.md)
* [contains (EN)](./wrapper-array/contains.md)
* [exists (EN)](./wrapper/exists.md)
* [destroy (EN)](./wrapper-array/destroy.md)
* [hasAttribute (EN)](./wrapper-array/hasAttribute.md)
* [hasClass (EN)](./wrapper-array/hasClass.md)
* [hasProp (EN)](./wrapper-array/hasProp.md)
Expand All @@ -51,10 +54,9 @@
* [setProps (EN)](./wrapper-array/setProps.md)
* [trigger (EN)](./wrapper-array/trigger.md)
* [update (EN)](./wrapper-array/update.md)
* [destroy (EN)](./wrapper-array/destroy.md)
* [components](./components/README.md)
* [TransitionStub](./components/TransitionStub.md)
* [TransitionGroupStub](./components/TransitionGroupStub.md)
* [components (EN)](./components/README.md)
* [TransitionStub (EN)](./components/TransitionStub.md)
* [TransitionGroupStub (EN)](./components/TransitionGroupStub.md)
* [Selectors (EN)](./selectors.md)
* [createLocalVue (EN)](./createLocalVue.md)
* [Selecteurs (EN)](./selectors.md)
* [config (EN)](./config.md)
* [config (EN)](./config.md)
6 changes: 3 additions & 3 deletions docs/fr/api/components/TransitionGroupStub.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# TransitionGroupStub

<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 component to stub the `transition-group` wrapper component. Instead of performing transitions asynchronously, it returns the child components synchronously.</p>
<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 component to stub the `transition-group` component. Instead of performing transitions asynchronously, it returns the child components synchronously.</p>

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:
This is set to stub all `transition-group` components by default in the `vue-test-utils` config. To use the built-in `transition-group` component set `config.stubs['transition-group']` to false:

```js
import VueTestUtils from 'vue-test-utils'

VueTestUtils.config.stubs['transition-group'] = false
```

To reset it to stub transition components:
To reset it to stub `transition-group` components:

```js
import VueTestUtils, { TransitionGroupStub } from 'vue-test-utils'
Expand Down
6 changes: 3 additions & 3 deletions docs/fr/api/components/TransitionStub.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# TransitionStub

<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 component to stub the `transition` wrapper component. Instead of performing transitions asynchronously, it returns the child component synchronously.</p>
<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 component to stub the `transition` component. Instead of performing transitions asynchronously, it returns the child component synchronously.</p>

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:
This is set to stub all `transition` components by default in the vue-test-utils config. To use the built-in `transition` component set `config.stubs.transition` to false:

```js
import VueTestUtils from 'vue-test-utils'

VueTestUtils.config.stubs.transition = false
```

To reset it to stub transition components:
To reset it to stub `transition` components:
```js
import VueTestUtils, { TransitionStub } from 'vue-test-utils'

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/api/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

Stubs to use in components. These are overwritten by `stubs` passed in the mounting options.

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.
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 `<!---->`.

Example:

Expand Down
4 changes: 2 additions & 2 deletions docs/fr/api/mount.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ import Faz from './Faz.vue'
describe('Foo', () => {
it('renders a div', () => {
const wrapper = mount(Foo, {
stub: {
Bar: '<div class="stubbed />',
stubs: {
Bar: '<div class="stubbed" />',
BarFoo: true,
FooBar: Faz
}
Expand Down
9 changes: 6 additions & 3 deletions docs/fr/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Vue options are passed to the component when a new instance is created. , e.g. `
- [`localVue`](#localvue)
- [`attachToDocument`](#attachtodocument)
- [`attrs`](#attrs)
- [`provide`](#provide)
- [`listeners`](#listeners)
- [`clone`](#clone)

Expand Down Expand Up @@ -61,7 +62,7 @@ expect(wrapper.find('div')).toBe(true)

- type: `{ [name: string]: Component | boolean } | Array<string>`

Stubs child components. Can be an Array of component names to stub, or an object.
Stubs child components. Can be an Array of component names to stub, or an object. If `stubs` is an Array, every stub is `<!---->`.

Example:

Expand Down Expand Up @@ -160,6 +161,8 @@ Set the component instance's `$listeners` object.

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

`options.mocks` (`Object`): Add globals to Vue instance.
### `provide`

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

Pass properties for components to use in injection. See [provide/inject](https://vuejs.org/v2/api/#provide-inject).
8 changes: 4 additions & 4 deletions docs/fr/api/wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ A `Wrapper` is an object that contains a mounted component or vnode and methods

- **Properties:**

`vm` `Component`: this is the `Vue` instance. You can access all the [instance methods and properties of a vm](https://vuejs.org/v2/api/#Instance-Properties) with `wrapper.vm`. This only exists on Vue component wrappers
`element` `HTMLElement`: the root DOM node of the wrapper
`options` `Object`: Object containing `vue-test-utils` options passed to `mount` or `shallow`
`options.attachedToDom` `Boolean`: True if `attachToDom` was passed to `mount` or `shallow`
`vm` `Component`: this is the `Vue` instance. You can access all the [instance methods and properties of a vm](https://vuejs.org/v2/api/#Instance-Properties) with `wrapper.vm`. This only exists on Vue component wrappers
`element` `HTMLElement`: the root DOM node of the wrapper
`options` `Object`: Object containing `vue-test-utils` options passed to `mount` or `shallow`
`options.attachedToDom` `Boolean`: True if `attachToDom` was passed to `mount` or `shallow`

- **Methods:**

Expand Down
2 changes: 1 addition & 1 deletion docs/fr/guides/common-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Des composants pourraient se fier à des fonctionnalités injectées par un plug
Si vous écrivez des tests pour des composants dans une application spécifique, vous pouvez mettre en place les mêmes plugins globaux et mixins en une seule fois dans vos tests. Dans certains cas, comme tester un composant générique utilisé par des applications différentes, il est favorable de tester ces composants dans une installation plus isolée, sans avoir à polluer le constructeur global `Vue`. On peut utiliser la méthode [`createLocalVue`](../api/createLocalVue.md) pour faire cela :

``` js
import createLocalVue from 'vue-test-utils'
import { createLocalVue } from 'vue-test-utils'

// créer un constructeur local de `Vue`
const localVue = createLocalVue()
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const wrapper = mount(MyButton)
wrapper.trigger('click')
```

Vous devez être au courant que la méthode `find` retourne aussi un wrapper. En partant du principe que `MyComponent` contient un bouton, le code suivant clique sur le bouton.
Vous devez être au courant que la méthode `find` retourne aussi un `Wrapper`. En partant du principe que `MyComponent` contient un bouton, le code suivant clique sur le bouton.

```js
const wrapper = mount(MyComponent)
Expand Down
30 changes: 29 additions & 1 deletion docs/fr/guides/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pour commencer
HE# Pour commencer

## Installation

Expand Down Expand Up @@ -110,6 +110,34 @@ Pour simplifier cela, `vue-test-utils` applique toutes les mises à jour de faç

*Note : `nextTick` est toujours nécessaire quand vous souhaitez explicitement faire avancer la boucle des évènements, pour des opérations telles que des fonctions de rappel ou des résolutions de promesses.*

Si vous avez toujours besoin de `nextTick` dans vos fichiers de tests, faites attention aux erreurs jetées aux erreurs lancées à l'intérieur qui peuvent ne pas être attrapées par votre lanceur de tests car il utilise des promesses. Il y a deux approches pour régler celà : vous pouvez affecter la fonction de rappel `done` du système de gestion d'erreurs globales de Vue au démarrage des tests, ou vous pouvez appeler `nextTick` sans argument pour l'utiliser sous forme de promesse :

```js
// ceci ne sera pas intercepté
it('pas d\'interception, (done) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autant faire avec "pas d'interception"

Vue.nextTick(() => {
expect(true).toBe(false)
done()
})
})

// les deux tests ci-dessous vont fonctionner comme souhaité
it('attraper l\'erreur avec `done`', (done) => {
Vue.config.errorHandler = done
Vue.nextTick(() => {
expect(true).toBe(false)
done()
})
})

it('attraper l\'erreur avec une promesse', () => {
return Vue.nextTick()
.then(function () {
expect(true).toBe(false)
})
})
```

## Et après ?

- Intégrez `vue-test-utils` dans votre projet en [choisissant votre lanceur de tests](./choosing-a-test-runner.md)
Expand Down
7 changes: 3 additions & 4 deletions docs/fr/guides/using-with-vuex.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('Actions.vue', () => {
})
```

Que se passe-t-il ici ? Premièrement, on indique à Vue d'utiliser Vuex avec la méthode `use`. C'est tout simplement une surcouche de `Vue.use`.
Que se passe-t-il ici ? Premièrement, on indique à Vue d'utiliser Vuex avec la méthode `localVue.use`. C'est tout simplement une surcouche de `Vue.use`.

On va ensuite créer un store fictif en appelant `new Vuex.Store` avec nos propres valeurs. À noter que l'on indique uniquement nos actions, car on ne s'intéresse qu'à elles.

Expand All @@ -109,7 +109,6 @@ Génial, on peut désormais simuler des actions. Allons avoir comment simuler de

## Simuler des accesseurs


``` html
<template>
<div>
Expand Down Expand Up @@ -244,14 +243,14 @@ describe('Modules.vue', () => {
})
})

it('appelle l\'action du store moduleActionClick quand le bouton est cliqué', () => {
it("appelle l'action du store moduleActionClick quand le bouton est cliqué", () => {
const wrapper = shallow(Modules, { store, localVue })
const button = wrapper.find('button')
button.trigger('click')
expect(actions.moduleActionClick).toHaveBeenCalled()
})

it('affiche `state.inputValue` dans la première balise <p>', () => {
it("affiche `state.inputValue` dans la première balise <p>", () => {
const wrapper = shallow(Modules, { store, localVue })
const p = wrapper.find('p')
expect(p.text()).toBe(state.module.clicks.toString())
Expand Down