Skip to content

Commit e50e5e9

Browse files
committed
docs: update wrapper-arrat section to follow Vue docs format
1 parent 3e5ad44 commit e50e5e9

16 files changed

+80
-108
lines changed

docs/en/SUMMARY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@
3535
* [update](api/wrapper-array/update.md)
3636
* [setData](api/wrapper-array/setData.md)
3737
* [setProps](api/wrapper-array/setProps.md)
38-
* [text](api/wrapper-array/trigger.md)
38+
* [text](api/wrapper-array/text.md)
3939
* [trigger](api/wrapper-array/trigger.md)
4040
* [selectors](api/selectors.md)

docs/en/api/wrapper-array/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
A `WrapperArray` is an object that contains an array of [Wrappers](/api/wrapper/README.md), and methods to test the `Wrappers`.
44

5-
## Properties
5+
- **Properties:**
66

77
`length` `number`: the number of `Wrappers` contained in the `WrapperArray`
88

9-
## Methods
9+
- **Methods:**
1010

1111
There is a detailed list of methods in the WrapperArray section of the docs.

docs/en/api/wrapper-array/at.md

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# at(index)
22

3-
Returns Wrapper at `index`
3+
- **Arguments:**
4+
- `{number} index`
45

5-
### Arguments
6+
- **Returns:** `{Wrapper}`
67

7-
`index` (`number`): index of Wrapper to return.
8+
- **Usage:**
89

9-
### Returns
10-
11-
(`Wrapper`): returns `Wrapper` at `index` passed. Uses zero based numbering (i.e. first item is at index 0)
12-
13-
### Example
10+
Returns `Wrapper` at `index` passed. Uses zero based numbering (i.e. first item is at index 0).
1411

1512
```js
1613
import { shallow } from 'vue-test-utils'

docs/en/api/wrapper-array/contains.md

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
# contains(selector)
22

3-
Returns true if every wrapper in array contains selector. Use any valid [selector](/api/selectors.md).
3+
- **Arguments:**
4+
- `{string|Component} selector`
45

5-
### Arguments
6+
- **Returns:** `{boolean}`
67

7-
`selector` (`String`|`Component`): a CSS selector ('#id', '.class-name', 'tag') or a Vue component. See [selectors](/api/selectors.md).
8+
- **Usage:**
89

9-
### Returns
10+
Assert every wrapper in `WrapperArray` contains selector.
1011

11-
(`Boolean`): returns `true` if every wrapper in wrapper array contains selector.
12-
13-
### Example
14-
15-
```js
16-
import { shallow } from 'vue-test-utils'
17-
import { expect } from 'chai'
18-
import Foo from './Foo.vue'
19-
20-
const wrapper = shallow(Foo)
21-
const divArray = wrapper.findAll('div')
22-
expect(divArray.contains('p')).to.equal(true)
23-
```
12+
Use any valid [selector](/api/selectors.md).
2413

2514
```js
2615
import { shallow } from 'vue-test-utils'
@@ -30,5 +19,6 @@ import Bar from './Bar.vue'
3019

3120
const wrapper = shallow(Foo)
3221
const divArray = wrapper.findAll('div')
22+
expect(divArray.contains('p')).to.equal(true)
3323
expect(divArray.contains(Bar)).to.equal(true)
3424
```

docs/en/api/wrapper-array/hasAttribute.md

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# hasAttribute(attribute, value)
22

3-
Check if every wrapper vnode in wrapper array has attribute matching value
3+
- **Arguments:**
4+
- `{string} attribute`
5+
- `{string} value`
46

5-
### Arguments
7+
- **Returns:** `{boolean}`
68

7-
`attribute` (`String`): attribute name to assert value of.
9+
- **Usage:**
810

9-
`value` (`String`): the value attribute should hold.
10-
11-
### Returns
12-
13-
(`Boolean`): `true` if every wrapper vnode contains attribute with matching value, `false` otherwise.
14-
15-
## Example
11+
Assert every `Wrapper` in `WrapperArray` DOM node has `attribute` matching `value`.
1612

1713
```js
1814
import { mount } from 'vue-test-utils'

docs/en/api/wrapper-array/hasClass.md

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# hasClass(className)
22

3-
Check if every wrapper vnode in wrapper array has a class name containing `className`. Returns a boolean.
3+
- **Arguments:**
4+
- `{string} className`
45

5-
### Arguments
6+
- **Returns:** `{boolean}`
67

7-
`className` (`String`): class name to assert vnode contains.
8+
- **Usage:**
89

9-
### Returns
10-
11-
(`Boolean`): `true` if every wrapper vnode contains class. `false` otherwise.
12-
13-
## Example
10+
Assert every `Wrapper` in `WrapperArray` DOM node has class containing `className`.
1411

1512
```js
1613
import { mount } from 'vue-test-utils'

docs/en/api/wrapper-array/hasProp.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@ Check if every wrapper vm in wrapper array has prop matching value
44

55
Can only be called on a Vue instance.
66

7-
### Arguments
7+
# hasProp(prop, value)
88

9-
`prop` (`String`): prop name to assert value of.
9+
- **Arguments:**
10+
- `{string} prop`
11+
- `{any} value`
1012

11-
`value` (`String`): the value prop should hold.
13+
- **Returns:** `{boolean}`
1214

13-
### Returns
15+
- **Usage:**
1416

15-
(`Boolean`): `true` if instance has prop. `false` if not.
17+
Assert every `Wrapper` in `WrapperArray` `vm` has `prop` matching `value`.
1618

17-
## Example
19+
**Note the Wrapper must contain a Vue instance.**
1820

1921
```js
2022
import { mount } from 'vue-test-utils'

docs/en/api/wrapper-array/hasStyle.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# hasStyle(style, value)
22

3-
Check if every wrapper vnode in wrapper array has a `style` matching `value`. Returns a boolean.
3+
- **Arguments:**
4+
- `{string} style`
5+
- `{string} value`
46

5-
### Arguments
7+
- **Returns:** `{boolean}`
68

7-
`style` (`String`): style name to assert value of.
8-
`value` (`String`): the value style property should hold.
9+
- **Usage:**
910

10-
### Returns
11+
Assert every `Wrapper` in `WrapperArray` DOM node has style matching value.
1112

12-
(`Boolean`): `true` if every wrapper vnode contains class. `false` otherwise.
13-
`false` otherwise.
13+
Returns `true` if `Wrapper` DOM node has `style` matching `string`.
14+
15+
**Note will only detect inline styles when running in `jsdom`.**
1416

15-
## Example
1617
```js
1718
import { mount } from 'vue-test-utils'
1819
import { expect } from 'chai'
@@ -22,7 +23,3 @@ const wrapper = mount(Foo)
2223
const divArray = wrapper.findAll('div')
2324
expect(divArray.hasStyle('color', 'red')).to.equal(true)
2425
```
25-
26-
### Note
27-
28-
Only checks inline styles when running in `jsdom`.

docs/en/api/wrapper-array/is.md

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# is(selector)
22

3-
Returns true if every wrapper in wrapper array matches selector. Use any valid [selector](/api/selectors.md).
3+
- **Arguments:**
4+
- `{string|Component} selector`
45

5-
### Arguments
6+
- **Returns:** `{boolean}`
67

7-
`selector` (`String`|`Component`): a CSS selector ('#id', '.class-name', 'tag') or a Vue component. See [selectors](/api/selectors.md).
8+
- **Usage:**
89

9-
### Returns
10-
11-
(`Boolean`): returns true if every wrapper in wrapper array matches selector.
12-
13-
### Example
10+
Assert every `Wrapper` in `WrapperArray` DOM node or `vm` matches [selector](/api/selectors.md).
1411

1512
```js
1613
import { mount } from 'vue-test-utils'
@@ -20,4 +17,4 @@ import Foo from './Foo.vue'
2017
const wrapper = mount(Foo)
2118
const divArray = wrapper.find('div')
2219
expect(divArray.is('div')).to.equal(true)
23-
```
20+
```

docs/en/api/wrapper-array/isEmpty.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# isEmpty()
22

3-
Check if every wrapper in wrapper array contains child nodes. Returns a boolean.
3+
- **Returns:** `{boolean}`
44

5-
### Returns
5+
- **Usage:**
66

7-
(`Boolean`): true if every wrapper in wrapper array does not contain any child nodes. False if it does.
8-
9-
## Example
7+
Assert every `Wrapper` in `WrapperArray` does not contain child node.
108

119
```js
1210
import { mount } from 'vue-test-utils'
@@ -16,4 +14,4 @@ import Foo from './Foo.vue'
1614
const wrapper = mount(Foo)
1715
const divArray = wrapper.findAll('div')
1816
expect(divArray.isEmpty()).to.equal(true)
19-
```
17+
```
+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# isVueInstance()
22

3-
Check if every wrapper in wrapper array is vue instance. Returns a boolean.
3+
- **Returns:** `{boolean}`
44

5-
### Returns
5+
- **Usage:**
66

7-
(`Boolean`): true if node does is vue instance. False if not.
8-
9-
## Example
7+
Assert every `Wrapper` in `WrapperArray` is Vue instance.
108

119
```js
1210
import { mount } from 'vue-test-utils'
@@ -17,4 +15,4 @@ import Bar from './Bar.vue'
1715
const wrapper = mount(Foo)
1816
const barArray = wrapper.findAll(Bar)
1917
expect(barArray.isVueInstance()).to.equal(true)
20-
```
18+
```

docs/en/api/wrapper-array/setData.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# setData(data)
22

3-
Sets Vue instance data and forces update of every wrapper in wrapper array.
3+
- **Arguments:**
4+
- `{Object} data`
45

5-
Can only be called on a wrapper array of Vue component wrappers.
6+
- **Usage:**
67

7-
### Arguments
8+
Sets `Wrapper` `vm` data and forces update on each `Wrapper` in `WrapperArray`.
89

9-
data (`Object`): Data properties and corresponding value to set
10-
11-
### Example
10+
**Note every `Wrapper` must contain a Vue instance.**
1211

1312
```js
1413
import { mount } from 'vue-test-utils'
@@ -20,4 +19,4 @@ const wrapper = mount(Foo)
2019
const barArray = wrapper.findAll(Bar)
2120
barArray.setData({ foo: 'bar' })
2221
expect(barArray.at(0).vm.foo).to.equal('bar')
23-
```
22+
```

docs/en/api/wrapper-array/setProps.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# setProps(data)
1+
# setProps(props)
22

3-
Sets Vue instance props and forces update of every wrapper in wrapper array.
3+
- **Arguments:**
4+
- `{Object} props`
45

5-
Can only be called on a wrapper array of Vue component wrappers.
6+
- **Usage:**
67

7-
### Arguments
8+
Sets `Wrapper` `vm` props and forces update on each `Wrapper` in `WrapperArray`.
89

9-
props (`Object`): Props properties and corresponding value to set
10-
11-
### Example
10+
**Note every `Wrapper` must contain a Vue instance.**
1211

1312
```js
1413
import { mount } from 'vue-test-utils'
@@ -20,5 +19,4 @@ const wrapper = mount(Foo)
2019
const barArray = wrapper.findAll(Bar)
2120
barArray.setProps({ foo: 'bar' })
2221
expect(barArray.at(0).vm.foo).to.equal('bar')
23-
```
24-
22+
```

docs/en/api/wrapper-array/trigger.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# trigger(eventName)
22

3-
Triggers an event on each wrapper in the wrapper array
3+
- **Arguments:**
4+
- `{string} eventName
45

5-
### Arguments
6+
- **Usage:**
67

7-
event (`String`): type of event (e.g. click).
8+
Triggers an event on every `Wrapper` in the `WrapperArray` DOM node.
89

9-
## Example
10+
**Note every `Wrapper` must contain a Vue instance.**
1011

1112
```js
1213
import { mount } from 'vue-test-utils'
@@ -22,4 +23,4 @@ const wrapper = mount(Foo, {
2223
const divArray = wrapper.findAll('div')
2324
divArray.trigger('click')
2425
expect(clickHandler.called).to.equal(true)
25-
```
26+
```

docs/en/api/wrapper-array/update.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# update()
22

3-
Force root Vue component to re-render.
3+
- **Usage:**
4+
5+
Force root Vue component of each `Wrapper` in `WrapperArray` to re-render.
46

57
If called on a Vue component wrapper array, it will force each Vue component to re-render.
68

docs/en/api/wrapper/isEmpty.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
- **Usage:**
66

7-
Assert `Wrapper`contains child node.
7+
Assert `Wrapper` does not contain child node.
88

99
```js
1010
import { mount } from 'vue-test-utils'

0 commit comments

Comments
 (0)