Skip to content
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

docs(fr): french documentation and README.md #1975

Merged
merged 5 commits into from Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 40 additions & 36 deletions README.md
Expand Up @@ -2,6 +2,10 @@

Component testing utils for Vue 3.

## Languages

[🇫🇷 French version of this README.md](https://github.com/vuejs/test-utils/tree/main/docs/fr/README.md)

## Installation and Usage

- yarn: `yarn add @vue/test-utils --dev`
Expand Down Expand Up @@ -31,47 +35,47 @@ This is table for those coming from VTU 1, comparing the two APIs. Some things a

### Mounting Options

| option | status | notes |
| ---------------- | ------ | ----------------------------------------------------------------------------------- |
| data | ✅ |
| slots | ✅ |
| mocks | ✅ | nested in `global` |
| propsData | ✅ | now called `props` |
| provide | ✅ | nested in `global` |
| mixins | ✅ | (new!) nested in `global` |
| plugins | ✅ | (new!) nested in `global` |
| component | ✅ | (new!) nested in `global` |
| directives | ✅ | (new!) nested in `global` |
| stubs | ✅ |
| attachToDocument | ✅ | renamed `attachTo`. See [here](https://github.com/vuejs/vue-test-utils/pull/1492) |
| attrs | ✅ |
| scopedSlots | ⚰️ | scopedSlots are merged with `slots` in Vue 3 |
| context | ⚰️ | different from Vue 2, does not make sense anymore. |
| localVue | ⚰️ | no longer required - Vue 3 there is no global Vue instance to mutate. |
| listeners | ⚰️ | no longer exists in Vue 3 |
| option | status | notes |
|------------------|--------|-----------------------------------------------------------------------------------|
| data | ✅ |
| slots | ✅ |
| mocks | ✅ | nested in `global` |
| propsData | ✅ | now called `props` |
| provide | ✅ | nested in `global` |
| mixins | ✅ | (new!) nested in `global` |
| plugins | ✅ | (new!) nested in `global` |
| component | ✅ | (new!) nested in `global` |
| directives | ✅ | (new!) nested in `global` |
| stubs | ✅ |
| attachToDocument | ✅ | renamed `attachTo`. See [here](https://github.com/vuejs/vue-test-utils/pull/1492) |
| attrs | ✅ |
| scopedSlots | ⚰️ | scopedSlots are merged with `slots` in Vue 3 |
| context | ⚰️ | different from Vue 2, does not make sense anymore. |
| localVue | ⚰️ | no longer required - Vue 3 there is no global Vue instance to mutate. |
| listeners | ⚰️ | no longer exists in Vue 3 |
| parentComponent | ⚰️ |

### Wrapper API (mount)

| method | status | notes |
| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| attributes | ✅ |
| classes | ✅ |
| exists | ✅ |
| find | ✅ | only `querySelector` syntax is supported. `find(Comp)` under discussion [here](https://github.com/vuejs/vue-test-utils/issues/1498) |
| emitted | ✅ |
| findAll | ✅ | see above. `.vm` is different to Vue 2. We are exploring options. |
| get | ✅ |
| html | ✅ |
| setValue | ✅ | works for select, checkbox, radio button, input, textarea. Returns `nextTick`. |
| text | ✅ |
| trigger | ✅ | returns `nextTick`. You can do `await wrapper.find('button').trigger('click')` |
| setProps | ✅ |
| props | ✅ |
| setData | ✅ |
| destroy | ✅ | renamed to `unmount` to match Vue 3 lifecycle hook name. |
| props | ✅ |
| isVisible | ✅ |
|----------------|--------|-------------------------------------------------------------------------------------------------------------------------------------|
| attributes | ✅ |
| classes | ✅ |
| exists | ✅ |
| find | ✅ | only `querySelector` syntax is supported. `find(Comp)` under discussion [here](https://github.com/vuejs/vue-test-utils/issues/1498) |
| emitted | ✅ |
| findAll | ✅ | see above. `.vm` is different to Vue 2. We are exploring options. |
| get | ✅ |
| html | ✅ |
| setValue | ✅ | works for select, checkbox, radio button, input, textarea. Returns `nextTick`. |
| text | ✅ |
| trigger | ✅ | returns `nextTick`. You can do `await wrapper.find('button').trigger('click')` |
| setProps | ✅ |
| props | ✅ |
| setData | ✅ |
| destroy | ✅ | renamed to `unmount` to match Vue 3 lifecycle hook name. |
| props | ✅ |
| isVisible | ✅ |
| contains | ⚰️ | use `find` |
| emittedByOrder | ⚰️ | use `emitted` |
| setSelected | ⚰️ | now part of `setValue` |
Expand Down
113 changes: 109 additions & 4 deletions docs/.vitepress/config.ts
@@ -1,17 +1,122 @@
import { defineConfig } from 'vitepress'
import packageJSON from '../../package.json'
import { defineConfig } from 'vitepress';
import { frLocaleConfig } from "../fr/.vitepress/locale-config";

export default defineConfig({
title: `Vue Test Utils`,
description: 'The documentation for the official Vue Test Utils',
locales: {
'/': {
"/": {
label: "English",
lang: 'en-US',
title: `Vue Test Utils`
}
},
"/fr/": {
label: "Français",
title: "Vue Test Utils",
lang: "fr-FR",
description: "La documentation officielle de Vue Test Utils",
},
},
head: [['link', { rel: 'icon', href: `/logo.png` }]],
themeConfig: {
locales: {
"/": {
label: 'English',
selectText: 'Languages',
nav: [
{ text: 'Guide', link: '/guide/' },
{ text: 'API Reference', link: '/api/' },
{ text: 'Migrating from Vue 2', link: '/migration/' },
{
text: 'Changelog',
link: 'https://github.com/vuejs/test-utils/releases'
}
],
sidebar: [
{
text: 'Installation',
link: '/installation/'
},
{
text: 'Essentials',
collapsable: false,
children: [
{ text: 'Getting Started', link: '/guide/' },
{ text: 'A Crash Course', link: '/guide/essentials/a-crash-course' },
{
text: 'Conditional Rendering',
link: '/guide/essentials/conditional-rendering'
},
{
text: 'Testing Emitted Events',
link: '/guide/essentials/event-handling'
},
{ text: 'Testing Forms', link: '/guide/essentials/forms' },
{
text: 'Passing Data to Components',
link: '/guide/essentials/passing-data'
},
{
text: 'Write components that are easy to test',
link: '/guide/essentials/easy-to-test'
}
]
},
{
text: 'Vue Test Utils in depth',
collapsable: false,
children: [
{ text: 'Slots', link: '/guide/advanced/slots' },
{
text: 'Asynchronous Behavior',
link: '/guide/advanced/async-suspense'
},
{
text: 'Making HTTP Requests',
link: '/guide/advanced/http-requests'
},
{ text: 'Transitions', link: '/guide/advanced/transitions' },
{
text: 'Component Instance',
link: '/guide/advanced/component-instance'
},
{
text: 'Reusability and Composition',
link: '/guide/advanced/reusability-composition'
},
{ text: 'Testing v-model', link: '/guide/advanced/v-model' },
{ text: 'Testing Vuex', link: '/guide/advanced/vuex' },
{ text: 'Testing Vue Router', link: '/guide/advanced/vue-router' },
{ text: 'Testing Teleport', link: '/guide/advanced/teleport' },
{
text: 'Stubs and Shallow Mount',
link: '/guide/advanced/stubs-shallow-mount'
}
]
},
{
text: 'Extending Vue Test Utils',
collapsable: false,
children: [
{ text: 'Plugins', link: '/guide/extending-vtu/plugins' },
{
text: 'Community and Learning',
link: '/guide/extending-vtu/community-learning'
}
]
},
{
text: 'Migrating from Vue 2',
link: '/migration/'
},
{
text: 'API Reference',
link: '/api/'
}
]
},
"/fr/": frLocaleConfig,
},
repo: 'vuejs/test-utils',
docsRepo: 'vuejs/test-utils',
docsDir: 'docs',
Expand Down
4 changes: 2 additions & 2 deletions docs/api/index.md
Expand Up @@ -44,7 +44,7 @@ test('mounts a component', () => {

Notice that `mount` accepts a second parameter to define the component's state configuration.

**Example: mounting with component props and a Vue App plugin**
**Exemple : mounting with component props and a Vue App plugin**

```js
const wrapper = mount(Component, {
Expand Down Expand Up @@ -1947,7 +1947,7 @@ type GlobalMountOptions = {

Instead of configuring mounting options on a per test basis, you can configure them for your entire test suite. These will be used by default every time you `mount` a component. If desired, you can then override your defaults on a per test basis.

**Example:**
**Exemple :**

An example might be globally mocking the `$t` variable from vue-i18n and a component:

Expand Down
100 changes: 100 additions & 0 deletions docs/fr/.vitepress/locale-config.ts
@@ -0,0 +1,100 @@
import { DefaultTheme } from "vitepress";

const frLocaleConfig: DefaultTheme.LocaleConfig & Omit<DefaultTheme.Config, "locales"> = {
label: 'Français',
selectText: 'Langues',
nav: [
{ text: 'Guide', link: '/fr/guide/' },
{ text: 'API', link: '/fr/api/' },
{ text: 'Migrer depuis Vue 2', link: '/fr/migration/' },
{
text: 'Journal de modifications',
link: 'https://github.com/vuejs/test-utils/releases'
}
],
sidebar: [
{
text: 'Installation',
link: '/fr/installation/'
},
{
text: 'Les Bases',
collapsable: false,
children: [
{ text: 'Pour commencer', link: '/fr/guide/' },
{ text: 'Cours rapide', link: '/fr/guide/essentials/a-crash-course' },
{
text: 'Rendu conditionnel',
link: '/fr/guide/essentials/conditional-rendering'
},
{
text: 'Tester les évènements émis',
link: '/fr/guide/essentials/event-handling'
},
{ text: 'Tester les formulaires', link: '/fr/guide/essentials/forms' },
{
text: 'Passer des données aux Composants',
link: '/fr/guide/essentials/passing-data'
},
{
text: 'Écrire des composants facile à tester',
link: '/fr/guide/essentials/easy-to-test'
}
]
},
{
text: 'Vue Test Utils en détail',
collapsable: false,
children: [
{ text: 'Slots', link: '/fr/guide/advanced/slots' },
{
text: 'Comportement asynchrone',
link: '/fr/guide/advanced/async-suspense'
},
{
text: 'Faire des requêtes HTTP',
link: '/fr/guide/advanced/http-requests'
},
{ text: 'Transitions', link: '/fr/guide/advanced/transitions' },
{
text: 'Instance de Composant',
link: '/fr/guide/advanced/component-instance'
},
{
text: 'Réutilisabilité et Composition',
link: '/fr/guide/advanced/reusability-composition'
},
{ text: 'Tester v-model', link: '/fr/guide/advanced/v-model' },
{ text: 'Tester Vuex', link: '/fr/guide/advanced/vuex' },
{ text: 'Tester Vue Router', link: '/fr/guide/advanced/vue-router' },
{ text: 'Tester Teleport', link: '/fr/guide/advanced/teleport' },
{
text: 'Composants de Substitution (Stubs) et Montage Partiel',
link: '/fr/guide/advanced/stubs-shallow-mount'
},
{ text: 'Tester le Rendu côté Serveur (SSR)', link: '/fr/guide/advanced/ssr' }
]
},
{
text: 'Extensions de Vue Test Utils',
collapsable: false,
children: [
{ text: 'Plugins', link: '/fr/guide/extending-vtu/plugins' },
{
text: 'Communauté et Apprentissage',
link: '/fr/guide/extending-vtu/community-learning'
}
]
},
{
text: 'Migrer depuis Vue 2',
link: '/fr/migration/'
},
{
text: 'API',
link: '/fr/api/'
}
]
};

export { frLocaleConfig };