-
Notifications
You must be signed in to change notification settings - Fork 665
Add french Version #1837
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
Add french Version #1837
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ff9a147
add french version
phrobinet 792d267
add more
phrobinet dd36ddc
Merge branch 'vuejs:dev' into dev
phrobinet 5804eac
update of the french version in relation to the feedback
phrobinet c499a9d
Merge branch 'dev' into french
lmiller1990 669c826
docs: fix some errors in linting docs
lmiller1990 9041426
Merge branch 'vuejs:dev' into dev
phrobinet 908c2a9
fixed the sidebar and updated the README files in the Wrapper and Ins…
phrobinet f7bade8
Merge branch 'vuejs:dev' into dev
phrobinet 8936d5f
update with prettier run
phrobinet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Introduction | ||
|
||
Vue Test Utils est la bibliothèque officielle de tests unitaires pour Vue.js. | ||
|
||
Voici la documentation de Vue Test Utils v1, qui vise Vue 2 et les versions antérieures. | ||
|
||
En bref : | ||
|
||
- [Vue Test Utils 1](https://github.com/vuejs/vue-test-utils/) objectifs [Vue 2](https://github.com/vuejs/vue/). | ||
- [Vue Test Utils 2](https://github.com/vuejs/vue-test-utils-next/) objectifs [Vue 3](https://github.com/vuejs/vue-next/). | ||
phrobinet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<div class="vueschool"><a href="https://vueschool.io/courses/learn-how-to-test-vuejs-components?friend=vuejs" target="_blank" rel="sponsored noopener" title="Learn how to use Vue Test Utils to test Vue.js Components with Vue School">Apprenez comment tester les composants de Vue.js avec Vue School</a></div> | ||
|
||
- [Installation](./installation/) | ||
- [Guides](./guides/) | ||
- [Pour commencer](./guides/getting-started.md) | ||
- [Les Conseils pratiques](guides/common-tips.md) | ||
- [Test des touches, de la souris et d'autres événements DOM](guides/dom-events.md) | ||
- [Tester le comportement asynchrone](guides/testing-async-components.md) | ||
- [Utilisation avec TypeScript](guides/using-with-typescript.md) | ||
- [Utilisation avec Vue Router](guides/using-with-vue-router.md) | ||
- [Utilisation avec Vuex](guides/using-with-vuex.md) | ||
- [Bibliothèques utiles pour les tests](guides/useful-libraries-for-testing.md) | ||
- [API](api/) | ||
- [mount](api/mount.md) | ||
- [shallowMount](api/shallowMount.md) | ||
- [render](api/render.md) | ||
- [renderToString](api/renderToString.md) | ||
- [Mounting Options](api/options.md) | ||
- [context](api/options.md#context) | ||
- [slots](api/options.md#slots) | ||
- [scopedSlots](api/options.md#scopedslots) | ||
- [stubs](api/options.md#stubs) | ||
- [mocks](api/options.md#mocks) | ||
- [localVue](api/options.md#localvue) | ||
- [attachToDocument](api/options.md#attachtodocument) | ||
- [attrs](api/options.md#attrs) | ||
- [propsData](api/options.md#propsdata) | ||
- [listeners](api/options.md#listeners) | ||
- [parentComponent](api/options.md#parentComponent) | ||
- [provide](api/options.md#provide) | ||
- [other options](api/options.md#other-options) | ||
- [Wrapper](api/wrapper/) | ||
- [attributes](api/wrapper/attributes.md) | ||
- [classes](api/wrapper/classes.md) | ||
- [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) | ||
- [get](api/wrapper/get.md) | ||
- [html](api/wrapper/html.md) | ||
- [is](api/wrapper/is.md) | ||
- [isEmpty](api/wrapper/isEmpty.md) | ||
- [isVueInstance](api/wrapper/isVueInstance.md) | ||
- [name](api/wrapper/name.md) | ||
- [props](api/wrapper/props.md) | ||
- [setChecked](api/wrapper/setChecked.md) | ||
- [setData](api/wrapper/setData.md) | ||
- [setMethods](api/wrapper/setMethods.md) | ||
- [setProps](api/wrapper/setProps.md) | ||
- [setSelected](api/wrapper/setSelected.md) | ||
- [setValue](api/wrapper/setValue.md) | ||
- [text](api/wrapper/text.md) | ||
- [trigger](api/wrapper/trigger.md) | ||
- [isVisible](api/wrapper/isVisible.md) | ||
- [WrapperArray](api/wrapper-array/) | ||
- [at](api/wrapper-array/at.md) | ||
- [contains](api/wrapper-array/contains.md) | ||
- [exists](api/wrapper/exists.md) | ||
- [destroy](api/wrapper-array/destroy.md) | ||
- [filter](api/wrapper-array/filter.md) | ||
- [is](api/wrapper-array/is.md) | ||
- [isEmpty](api/wrapper-array/isEmpty.md) | ||
- [isVueInstance](api/wrapper-array/isVueInstance.md) | ||
- [setChecked](api/wrapper-array/setChecked.md) | ||
- [setData](api/wrapper-array/setData.md) | ||
- [setMethods](api/wrapper-array/setMethods.md) | ||
- [setProps](api/wrapper-array/setProps.md) | ||
- [setValue](api/wrapper-array/setValue.md) | ||
- [trigger](api/wrapper-array/trigger.md) | ||
- [isVisible](api/wrapper-array/isVisible.md) | ||
- [components](api/components/) | ||
- [RouterLinkStub](api/components/RouterLinkStub.md) | ||
- [Selectors](api/selectors.md) | ||
- [createWrapper](api/createWrapper.md) | ||
- [createLocalVue](api/createLocalVue.md) | ||
- [config](api/config.md) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# API | ||
|
||
!!!include(docs/fr/api/mount.md)!!! | ||
!!!include(docs/fr/api/shallowMount.md)!!! | ||
!!!include(docs/fr/api/render.md)!!! | ||
!!!include(docs/fr/api/renderToString.md)!!! | ||
!!!include(docs/fr/api/selectors.md)!!! | ||
!!!include(docs/fr/api/createLocalVue.md)!!! | ||
!!!include(docs/fr/api/createWrapper.md)!!! | ||
!!!include(docs/fr/api/config.md)!!! | ||
!!!include(docs/fr/api/enableAutoDestroy.md)!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,4 @@ | ||||||
# Components | ||||||
|
||||||
Vue Test Utils comprend des composants utilitaires que vous pouvez utiliser pour avoir des composants stubs | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
!!!include(docs/fr/api/components/RouterLinkStub.md)!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## RouterLinkStub | ||
|
||
Un composant pour mettre en place le composant Vue Router `router-link`. | ||
|
||
Vous pouvez utiliser ce composant pour trouver un composant router-link dans l'arbre de rendu. | ||
|
||
- **Usage:** | ||
|
||
Pour le définir comme un stub dans les options de montage : | ||
|
||
```js | ||
import { mount, RouterLinkStub } from '@vue/test-utils' | ||
|
||
const wrapper = mount(Component, { | ||
stubs: { | ||
RouterLink: RouterLinkStub | ||
} | ||
}) | ||
expect(wrapper.find(RouterLinkStub).props().to).toBe('/some/path') | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
## Config | ||
|
||
Vue Test Utils comprend un objet de configuration des options définies utilisées par Vue Test Utils. | ||
|
||
### Vue Test Utils Config Options | ||
|
||
### `showDeprecationWarnings` | ||
|
||
- type: `Boolean` | ||
- default: `true` | ||
|
||
Contrôler s'il faut ou non afficher des avertissements de dépréciation . Lorsqu'il est sur `true`, tous les avertissements de déprédation sont visibles dans la console. | ||
phrobinet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Exemple: | ||
|
||
```js | ||
import { config } from '@vue/test-utils' | ||
|
||
config.showDeprecationWarnings = false | ||
``` | ||
|
||
### `deprecationWarningHandler` | ||
|
||
- type: `Function` | ||
|
||
Permet un contrôle fin des avertissements de dépréciation. Lorsque `showDeprecationWarnings` est défini à `true`, tous les avertissements de dépréciation seront passés à ce gestionnaire avec le nom de la méthode comme premier argument et le message original comme second. | ||
|
||
::: tip | ||
Cela peut être utile pour enregistrer les messages de dépréciation à un endroit séparé ou pour aider à la mise à jour progressive de la base de code vers la dernière version de test utils en ignorant certains avertissements de fonctions dépréciées. | ||
::: | ||
|
||
Example: | ||
|
||
```js | ||
import { config } from '@vue/test-utils' | ||
|
||
config.showDeprecationWarnings = true | ||
config.deprecationWarningHandler = (method, message) => { | ||
if (method === 'emittedByOrder') return | ||
|
||
console.error(msg) | ||
} | ||
``` | ||
|
||
### `stubs` | ||
|
||
- type: `{ [name: string]: Component | boolean | string }` | ||
- default: `{}` | ||
|
||
Le stub stocké dans `config.stubs` est utilisé par défaut. | ||
Les stubs sont à utiliser dans les composants. Ils sont écrasés par les `stubs` passés dans les options de montage. | ||
|
||
Lorsque l'on passe des `stubs` sous forme de tableau dans les options de montage, les `config.stubs` sont convertis en un tableau, et vont stuber les composants avec un composant de base qui retourne `<${component name}-stub>`. | ||
|
||
Exemple: | ||
|
||
```js | ||
import { config } from '@vue/test-utils' | ||
|
||
config.stubs['my-component'] = '<div />' | ||
``` | ||
|
||
### `mocks` | ||
|
||
- type: `Object` | ||
- default: `{}` | ||
|
||
Comme pour les `stubs`, les valeurs passées à `config.mocks` sont utilisées par défaut. Toute valeur passées à l'objet d'options de montage `mocks` aura la priorité sur celles déclarées dans `config.mocks`. | ||
phrobinet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Exemple: | ||
|
||
```js | ||
import { config } from '@vue/test-utils' | ||
|
||
config.mocks['$store'] = { | ||
state: { | ||
id: 1 | ||
} | ||
} | ||
``` | ||
|
||
### `methods` | ||
|
||
- type: `{ [name: string]: Function }` | ||
- default: `{}` | ||
|
||
Vous pouvez configurer les méthodes par défaut en utilisant l'objet `config`. Cela peut être utile pour les plugins qui injectent des méthodes aux composants, comme [VeeValidate](https://logaretm.github.io/vee-validate/). Vous pouvez surcharger les méthodes définies dans `config` en passant des `méthodes` dans les options de montage. | ||
|
||
Exemple: | ||
|
||
```js | ||
import { config } from '@vue/test-utils' | ||
|
||
config.methods['getData'] = () => {} | ||
``` | ||
|
||
### `provide` | ||
|
||
- type: `Object` | ||
- default: `{}` | ||
|
||
Comme les `stubs` ou `mocks`, les valeurs passées à "config.provide" sont utilisées par défaut. Toutes les valeurs passées à l'objet d'options de montage `provide` auront la priorité sur celles déclarées dans `config.provide`. **Veuillez noter qu'il n'est pas possible de passer une fonction comme `config.provide`.** | ||
|
||
Exemple: | ||
|
||
```js | ||
import { config } from '@vue/test-utils' | ||
|
||
config.provide['$logger'] = { | ||
log: (...args) => { | ||
console.log(...args) | ||
} | ||
} | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
## createLocalVue() | ||
|
||
- **Arguments:** | ||
|
||
- `{Object} options` | ||
- `{Function} errorHandler` | ||
|
||
- **Retours:** | ||
|
||
- `{Component}` | ||
|
||
- **Usage:** | ||
|
||
`createLocalVue` renvoie une classe Vue pour que vous puissiez ajouter des composants, des mixins et installer des plugins dans polluer la classe Vue globale. | ||
phrobinet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
L'option `errorHandler` peut être utilisée pour gérer les erreurs non attrapées pendant la fonction de rendu du composant et les observateurs. | ||
|
||
Utilisez-la avec `options.localVue`: | ||
|
||
**Sans les options:** | ||
|
||
```js | ||
import { createLocalVue, shallowMount } from '@vue/test-utils' | ||
import MyPlugin from 'my-plugin' | ||
import Foo from './Foo.vue' | ||
|
||
const localVue = createLocalVue() | ||
localVue.use(MyPlugin) | ||
const wrapper = shallowMount(Foo, { | ||
localVue, | ||
mocks: { foo: true } | ||
}) | ||
expect(wrapper.vm.foo).toBe(true) | ||
|
||
const freshWrapper = shallowMount(Foo) | ||
expect(freshWrapper.vm.foo).toBe(false) | ||
``` | ||
|
||
**Avec l'option [`errorHandler`](https://vuejs.org/v2/api/#errorHandler):** | ||
|
||
```js | ||
import { createLocalVue, shallowMount } from '@vue/test-utils' | ||
import Foo from './Foo.vue' | ||
|
||
const errorHandler = (err, vm, info) => { | ||
expect(err).toBeInstanceOf(Error) | ||
} | ||
|
||
const localVue = createLocalVue({ | ||
errorHandler | ||
}) | ||
|
||
// Foo lance une erreur à l'intérieur d'un crochet de cycle de vie | ||
const wrapper = shallowMount(Foo, { | ||
localVue | ||
}) | ||
``` | ||
|
||
- **Voir aussi:** [Common Tips](../guides/common-tips.md#applying-global-plugins-and-mixins) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## createWrapper(node [, options]) | ||
|
||
- **Arguments:** | ||
|
||
- `{vm|HTMLElement} node` | ||
- `{Object} options` | ||
- `{Boolean} attachedToDocument` | ||
|
||
- **Retours:** | ||
|
||
- `{Wrapper}` | ||
|
||
- **Usage:** | ||
|
||
`createWrapper` crée un `Wrapper` pour une instance Vue montée, ou un élément HTML. | ||
|
||
```js | ||
import { createWrapper } from '@vue/test-utils' | ||
import Foo from './Foo.vue' | ||
|
||
const Constructor = Vue.extend(Foo) | ||
const vm = new Constructor().$mount() | ||
const wrapper = createWrapper(vm) | ||
expect(wrapper.vm.foo).toBe(true) | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.