diff --git a/docs/fr/api/README.md b/docs/fr/api/README.md index 400bdbccf..c59df9fc0 100644 --- a/docs/fr/api/README.md +++ b/docs/fr/api/README.md @@ -2,7 +2,7 @@ * [mount (EN)](./mount.md) * [shallow (EN)](./shallow.md) -* [Options de montage (EN)](./options.md) +* [Mounting Options (EN)](./options.md) - [context (EN)](./options.md#context) - [slots (EN)](./options.md#slots) - [stubs (EN)](./options.md#stubs) @@ -15,7 +15,7 @@ * [contains (EN)](./wrapper/contains.md) * [emitted (EN)](./wrapper/emitted.md) * [emittedByOrder (EN)](./wrapper/emittedByOrder.md) - * [exists](./wrapper/exists.md) + * [exists (EN)](./wrapper/exists.md) * [destroy (EN)](./wrapper/destroy.md) * [find (EN)](./wrapper/find.md) * [findAll (EN)](./wrapper/findAll.md) @@ -28,17 +28,17 @@ * [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) * [WrapperArray (EN)](./wrapper-array/README.md) * [at (EN)](./wrapper-array/at.md) * [contains (EN)](./wrapper-array/contains.md) - * [exists](./wrapper/exists.md) + * [exists (EN)](./wrapper/exists.md) * [destroy (EN)](./wrapper-array/destroy.md) * [hasAttribute (EN)](./wrapper-array/hasAttribute.md) * [hasClass (EN)](./wrapper-array/hasClass.md) @@ -53,9 +53,9 @@ * [setProps (EN)](./wrapper-array/setProps.md) * [trigger (EN)](./wrapper-array/trigger.md) * [update (EN)](./wrapper-array/update.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) diff --git a/docs/fr/api/components/TransitionGroupStub.md b/docs/fr/api/components/TransitionGroupStub.md index 3bf715b8b..5bede67d8 100644 --- a/docs/fr/api/components/TransitionGroupStub.md +++ b/docs/fr/api/components/TransitionGroupStub.md @@ -1,8 +1,8 @@ # TransitionGroupStub -

⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou participer à la traduction de celle-ci dès maintenant !

A component to stub the `transition-group` wrapper component. Instead of performing transitions asynchronously, it returns the child components synchronously.

+

⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou participer à la traduction de celle-ci dès maintenant !

A component to stub the `transition-group` component. Instead of performing transitions asynchronously, it returns the child components synchronously.

-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' @@ -10,7 +10,7 @@ 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' diff --git a/docs/fr/api/components/TransitionStub.md b/docs/fr/api/components/TransitionStub.md index 3ec0d4724..d03dbfbba 100644 --- a/docs/fr/api/components/TransitionStub.md +++ b/docs/fr/api/components/TransitionStub.md @@ -1,8 +1,8 @@ # TransitionStub -

⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou participer à la traduction de celle-ci dès maintenant !

A component to stub the `transition` wrapper component. Instead of performing transitions asynchronously, it returns the child component synchronously.

+

⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou participer à la traduction de celle-ci dès maintenant !

A component to stub the `transition` component. Instead of performing transitions asynchronously, it returns the child component synchronously.

-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' @@ -10,7 +10,7 @@ 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' diff --git a/docs/fr/api/config.md b/docs/fr/api/config.md index 7c7af33f1..e2d92890e 100644 --- a/docs/fr/api/config.md +++ b/docs/fr/api/config.md @@ -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: diff --git a/docs/fr/api/mount.md b/docs/fr/api/mount.md index 6fc5bb2bf..3e4b357c0 100644 --- a/docs/fr/api/mount.md +++ b/docs/fr/api/mount.md @@ -122,8 +122,8 @@ import Faz from './Faz.vue' describe('Foo', () => { it('renders a div', () => { const wrapper = mount(Foo, { - stub: { - Bar: '
', BarFoo: true, FooBar: Faz } diff --git a/docs/fr/api/options.md b/docs/fr/api/options.md index 5dbdc20f9..768550a06 100644 --- a/docs/fr/api/options.md +++ b/docs/fr/api/options.md @@ -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) ### `context` @@ -60,7 +61,7 @@ expect(wrapper.find('div')).toBe(true) - type: `{ [name: string]: Component | boolean } | Array` -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: @@ -152,6 +153,8 @@ Set the component instance's `$attrs` object. Set the component instance's `$listeners` object. -`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). diff --git a/docs/fr/guides/dom-events.md b/docs/fr/guides/dom-events.md index 3a5038752..7f490d3a3 100644 --- a/docs/fr/guides/dom-events.md +++ b/docs/fr/guides/dom-events.md @@ -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) @@ -70,7 +70,7 @@ import { mount } from 'vue-test-utils' import sinon from 'sinon' describe('Évènement click', () => { - it('Cliquer sur le bouton oui appelle notre méthode avec l\'argument "oui"', () => { + it("Cliquer sur le bouton oui appelle notre méthode avec l'argument « oui »", () => { const spy = sinon.spy() const wrapper = mount(YesNoComponent, { propsData: { @@ -173,7 +173,7 @@ describe('Tests événement clavier', () => { expect(wrapper.vm.quantity).to.equal(0) }) - it('Le caractère magique "a" positionne la quantité à 13', () => { + it('Le caractère magique `a` positionne la quantité à 13', () => { const wrapper = mount(QuantityComponent) wrapper.trigger('keydown', { which: 65 diff --git a/docs/fr/guides/getting-started.md b/docs/fr/guides/getting-started.md index c007c84f8..85b6ae6bf 100644 --- a/docs/fr/guides/getting-started.md +++ b/docs/fr/guides/getting-started.md @@ -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) => { + 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) diff --git a/docs/fr/guides/using-with-vuex.md b/docs/fr/guides/using-with-vuex.md index b87e71e85..3ccc979c5 100644 --- a/docs/fr/guides/using-with-vuex.md +++ b/docs/fr/guides/using-with-vuex.md @@ -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. @@ -109,7 +109,6 @@ Génial, on peut désormais simuler des actions. Allons avoir comment simuler de ## Simuler des accesseurs - ``` html