-
Notifications
You must be signed in to change notification settings - Fork 2
API: Wrapper array #17
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
Changes from all commits
db559e0
170f62c
23d1a8e
7de3edf
1309740
3401d06
9b0bd87
99b6734
105cbcf
70c701c
fee0bfe
a217128
84fecac
9e2ad1c
853f928
810e184
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# WrapperArray | ||
|
||
A `WrapperArray` is an object that contains an array of [Wrappers](../wrapper/README.md), and methods to test the `Wrappers`. | ||
Un `WrapperArray` est un objet contenant un tableau de [Wrappers](../wrapper/README.md) ainsi que les méthodes pour tester les `Wrappers`. | ||
|
||
- **Properties:** | ||
- **Propriétés :** | ||
|
||
`length` `number`: the number of `Wrappers` contained in the `WrapperArray` | ||
`length` `number`: le nombre de `Wrappers` que le `WrapperArray` contient. | ||
|
||
- **Methods:** | ||
- **Méthodes :** | ||
|
||
There is a detailed list of methods in the WrapperArray section of the docs. | ||
Il y a une liste détaillé des méthodes dans la section `WrapperArray` de la documentation. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# at(index) | ||
|
||
Returns `Wrapper` at `index` passed. Uses zero based numbering (i.e. first item is at index 0). | ||
Retourne le `Wrapper` à l'index passé en paramètre. L'indexation commence à 0. | ||
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. Retourne le
|
||
|
||
- **Arguments:** | ||
- **Paramètre :** | ||
- `{number} index` | ||
|
||
- **Returns:** `{Wrapper}` | ||
- **Retourne :** `{Wrapper}` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { shallow } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# contains(selector) | ||
|
||
Assert every wrapper in `WrapperArray` contains selector. | ||
Asserte que chaque `Wrapper` de `WrapperArray` contient un élément basé sur un sélecteur. | ||
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. Asserte que chaque
|
||
|
||
Use any valid [selector](../selectors.md). | ||
Utilisez n'importe quels [sélecteurs](../selectors.md). | ||
|
||
- **Arguments:** | ||
- `{string|Component} selector` | ||
- **Paramètre :** | ||
- `{string|Component} selector : un sélecteur` | ||
|
||
- **Returns:** `{boolean}` | ||
- **Retourne :** `{boolean}` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { shallow } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# hasAttribute(attribute, value) | ||
|
||
Assert every `Wrapper` in `WrapperArray` DOM node has `attribute` matching `value`. | ||
Asserte que chaque `Wrapper` de `WrapperArray` a un nœud du DOM qui a un attribut ayant une certaine valeur. | ||
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. qui a un attribut ayant une certaine valeur. => qui a un attribut ( |
||
|
||
- **Arguments:** | ||
- `{string} attribute` | ||
- `{string} value` | ||
- **Paramètres :** | ||
- `{string} attribute : l'attribut` | ||
- `{string} value : la valeur` | ||
|
||
- **Returns:** `{boolean}` | ||
- **Retourne :** `{boolean}` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { mount } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# hasClass(className) | ||
|
||
Assert every `Wrapper` in `WrapperArray` DOM node has class containing `className`. | ||
Asserte que chaque `Wrapper` de `WrapperArray` a un nœud du DOM qui a une classe `className`. | ||
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. a un nœud du DOM qui a une classe |
||
|
||
- **Arguments:** | ||
- `{string} className` | ||
- **Paramètre :** | ||
- `{string} className : nom d'une classe` | ||
|
||
- **Returns:** `{boolean}` | ||
- **Retourne :** `{boolean}` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { mount } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
# hasStyle(style, value) | ||
|
||
Assert every `Wrapper` in `WrapperArray` DOM node has style matching value. | ||
Asserte que chaque `Wrapper` de `WrapperArray` a un nœud DOM ayant un certain style avec une certaine valeur. | ||
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. un nœud DOM ayant un certain style avec une certaine valeur. => un nœud DOM ayant un style correspondant à une valeur ( |
||
|
||
Returns `true` if `Wrapper` DOM node has `style` matching `string`. | ||
Retourne `true` si le nœud du DOM du `Wrapper` contient un `style` correspondant à `value`. | ||
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. correspondant à |
||
|
||
**Note will only detect inline styles when running in `jsdom`.** | ||
- **Arguments:** | ||
**Note : cela va uniquement détecter les styles `inlines` quand il fonctionne avec `jsdom`.** | ||
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. cela va uniquement détecter les styles |
||
- **Paramètres :** | ||
- `{string} style` | ||
- `{string} value` | ||
- `{string} value : valeur` | ||
|
||
- **Returns:** `{boolean}` | ||
- **Retourne :** `{boolean}` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { mount } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# setData(data) | ||
|
||
Sets `Wrapper` `vm` data and forces update on each `Wrapper` in `WrapperArray`. | ||
Fixe les données de l'instance de Vue `vm` du `Wrapper` puis force la mise à jour sur chaque `Wrapper` de `WrapperArray`. | ||
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. Fixe => Définit |
||
|
||
**Note every `Wrapper` must contain a Vue instance.** | ||
**Note : chaque `Wrapper` doit contenir une instance de Vue.** | ||
|
||
- **Arguments:** | ||
- **Paramètre :** | ||
- `{Object} data` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { mount } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
|
||
# setMethods(methods) | ||
|
||
Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`. | ||
Fixe les méthodes de l'instance de Vue `vm` du `Wrapper` et force la mise à jour sur chaque `Wrapper` de `WrapperArray`. | ||
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. Fixe => Définit |
||
|
||
**Note every `Wrapper` must contain a Vue instance.** | ||
**Note : chaque `Wrapper` doit conenir une instance de Vue.** | ||
|
||
- **Arguments:** | ||
- **Paramètre :** | ||
- `{Object} methods` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { mount } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# setProps(props) | ||
|
||
Sets `Wrapper` `vm` props and forces update on each `Wrapper` in `WrapperArray`. | ||
Fixe les `props` de l'instance de Vue `vm` du `Wrapper` et force la mise à jour sur chaque `Wrapper` de `WrapperArray`. | ||
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. Fixe les |
||
|
||
**Note every `Wrapper` must contain a Vue instance.** | ||
**Note : chaque `Wrapper` doit contenir une instance de Vue.** | ||
|
||
- **Arguments:** | ||
- **Paramètre :** | ||
- `{Object} props` | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { mount } from 'vue-test-utils' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# update() | ||
|
||
Force root Vue component of each `Wrapper` in `WrapperArray` to re-render. | ||
Force le composant Vue principal de chaque `Wrapper` de `WrapperArray` à se mettre à jour. | ||
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. Force le composant Vue principal de chaque |
||
|
||
If called on a Vue component wrapper array, it will force each Vue component to re-render. | ||
Si appellée sur `WrapperArray`, il mettra à jour le composant de chaque `Wrapper`. | ||
|
||
- **Example:** | ||
- **Exemple :** | ||
|
||
```js | ||
import { mount } from 'vue-test-utils' | ||
|
@@ -14,7 +14,7 @@ import Foo from './Foo.vue' | |
const wrapper = mount(Foo) | ||
const divArray = wrapper.findAll('div') | ||
expect(divArray.at(0).vm.bar).toBe('bar') | ||
divArray.at(0).vm.bar = 'new value' | ||
divArray.at(0).vm.bar = 'nouvelle valeur' | ||
divArray.update() | ||
expect(divArray.at(0).vm.bar).toBe('new value') | ||
expect(divArray.at(0).vm.bar).toBe('nouvelle valeur') | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
détaillé => détaillée