Skip to content

Commit 55852e0

Browse files
committed
docs: move usage to top of every file
1 parent 88c5111 commit 55852e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+197
-134
lines changed

docs/en/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# vue-test-utils
1+
# Vue Test Utils
22

3-
vue-test-utils is the official test library for Vue.js.
3+
Vue Test Utils is the official test library for Vue.js.
44

5-
It provides methods for unit testing Vue components.
5+
It provides methods for [unit testing](guides/introduction-to-unit-tests.md) Vue components.
66

77
## Example
88

@@ -18,9 +18,9 @@ expect(wrapper.text()).toContain('1')
1818

1919
## Getting started
2020

21-
To get started using Vue Test Utils, please see [using with jest]().
21+
To get started using Vue Test Utils, please see [using with jest](guides/using-with-jest.md).
2222

23-
If you're new to unit testing, please read our [introduction to unit tests]().
23+
If you're new to unit testing, you can read our [introduction to unit tests](guides/introduction-to-unit-tests.md).
2424

2525
## Testing single file components (SFCs)
2626

docs/en/api/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
## [mount](/docs/en/api/mount.md)
2-
## [shallow](/docs/en/api/shallow.md)
3-
## [selectors](/docs/en/api/selectors.md)
1+
# API
2+
3+
## [mount](api/mount.md)
4+
## [shallow](shallow.md)
5+
## [options](options.md)
6+
## [createLocalVue](createLocalVue.md)
7+
## [selectors](selectors.md)

docs/en/api/createLocalVue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ const freshWrapper = shallow(Foo)
2525
expect(freshWrapper.vm.foo).to.equal(false)
2626
```
2727

28-
- **See also:** [Common Gotchas](/en/common-gotchas.md)
28+
- **See also:** [Common Gotchas](common-gotchas.md)

docs/en/api/mount.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
- **Options:**
1111

12-
See [options](/docs/en/api/options.md)
12+
See [options](options.md)
1313

1414
- **Usage:**
1515

16-
Returns [`Wrapper`](/docs/en/api/wrapper/README.md) of first DOM node or Vue component matching selector.
16+
Returns [`Wrapper`](wrapper/README.md) of first DOM node or Vue component matching selector.
1717

18-
Use any valid [selector](/docs/en/api/selectors.md).
18+
Use any valid [selector](selectors.md).
1919

2020
**Without options:**
2121

@@ -133,4 +133,4 @@ describe('Foo', () => {
133133
})
134134
```
135135

136-
- **See also:** [Wrapper](/docs/en/api/wrapper/README.md)
136+
- **See also:** [Wrapper](wrapper/README.md)

docs/en/api/options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Vue options are passed to the component when a new instance is created. , e.g. `
2222

2323
`options` (`Object`): a Vue options object. Vue options are passed to the component when a new instance is created. , e.g. `store`, `propsData`. For full list, see the [Vue API](https://vuejs.org/v2/api/). Also takes vue-test-utils options:
2424

25-
`options.attachToDocument` (`boolean`): Component will attach to DOM when rendered. This can be used with [`hasStyle`](/docs/en/api/wrapper/hasStyle.md) to check multi element CSS selectors
25+
`options.attachToDocument` (`boolean`): Component will attach to DOM when rendered. This can be used with [`hasStyle`](wrapper/hasStyle.md) to check multi element CSS selectors
2626

2727
`options.attrs` (`Object`): Attrs object to pass to component.
2828

@@ -34,7 +34,7 @@ Vue options are passed to the component when a new instance is created. , e.g. `
3434

3535
`options.intercept` (`Object`): Add globals to Vue instance.
3636

37-
`options.localVue` (`Object`): vue class to use in `mount`. See [createLocalVue](/docs/en/api/createLocalVue.md)
37+
`options.localVue` (`Object`): vue class to use in `mount`. See [createLocalVue](createLocalVue.md)
3838

3939
`options.propsData` (`Object`): Data for props in component
4040

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WrapperArray
22

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

55
- **Properties:**
66

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# at(index)
22

3+
- **Usage:**
4+
5+
Returns `Wrapper` at `index` passed. Uses zero based numbering (i.e. first item is at index 0).
6+
37
- **Arguments:**
48
- `{number} index`
59

610
- **Returns:** `{Wrapper}`
711

8-
- **Usage:**
9-
10-
Returns `Wrapper` at `index` passed. Uses zero based numbering (i.e. first item is at index 0).
12+
- **Example:**
1113

1214
```js
1315
import { shallow } from 'vue-test-utils'

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# contains(selector)
22

3+
- **Usage:**
4+
5+
Assert every wrapper in `WrapperArray` contains selector.
6+
7+
Use any valid [selector](../selectors.md).
8+
39
- **Arguments:**
410
- `{string|Component} selector`
511

612
- **Returns:** `{boolean}`
713

8-
- **Usage:**
9-
10-
Assert every wrapper in `WrapperArray` contains selector.
11-
12-
Use any valid [selector](/docs/en/api/selectors.md).
14+
- **Example:**
1315

1416
```js
1517
import { shallow } from 'vue-test-utils'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# hasAttribute(attribute, value)
22

3+
- **Usage:**
4+
5+
Assert every `Wrapper` in `WrapperArray` DOM node has `attribute` matching `value`.
6+
37
- **Arguments:**
48
- `{string} attribute`
59
- `{string} value`
610

711
- **Returns:** `{boolean}`
812

9-
- **Usage:**
10-
11-
Assert every `Wrapper` in `WrapperArray` DOM node has `attribute` matching `value`.
13+
- **Example:**
1214

1315
```js
1416
import { mount } from 'vue-test-utils'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# hasClass(className)
22

3+
- **Usage:**
4+
5+
Assert every `Wrapper` in `WrapperArray` DOM node has class containing `className`.
6+
37
- **Arguments:**
48
- `{string} className`
59

610
- **Returns:** `{boolean}`
711

8-
- **Usage:**
9-
10-
Assert every `Wrapper` in `WrapperArray` DOM node has class containing `className`.
12+
- **Example:**
1113

1214
```js
1315
import { mount } from 'vue-test-utils'

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
# hasProp(prop, value)
22

3-
Check if every wrapper vm in wrapper array has prop matching value
3+
- **Usage:**
44

5-
Can only be called on a Vue instance.
5+
Assert every `Wrapper` in `WrapperArray` `vm` has `prop` matching `value`.
66

7-
# hasProp(prop, value)
7+
**Note the Wrapper must contain a Vue instance.**
88

99
- **Arguments:**
1010
- `{string} prop`
1111
- `{any} value`
1212

1313
- **Returns:** `{boolean}`
1414

15-
- **Usage:**
16-
17-
Assert every `Wrapper` in `WrapperArray` `vm` has `prop` matching `value`.
18-
19-
**Note the Wrapper must contain a Vue instance.**
15+
- **Example:**
2016

2117
```js
2218
import { mount } from 'vue-test-utils'

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# hasStyle(style, value)
22

3-
- **Arguments:**
4-
- `{string} style`
5-
- `{string} value`
6-
7-
- **Returns:** `{boolean}`
8-
93
- **Usage:**
104

115
Assert every `Wrapper` in `WrapperArray` DOM node has style matching value.
126

137
Returns `true` if `Wrapper` DOM node has `style` matching `string`.
148

159
**Note will only detect inline styles when running in `jsdom`.**
10+
- **Arguments:**
11+
- `{string} style`
12+
- `{string} value`
13+
14+
- **Returns:** `{boolean}`
15+
16+
- **Example:**
1617

1718
```js
1819
import { mount } from 'vue-test-utils'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# is(selector)
22

3+
- **Usage:**
4+
5+
Assert every `Wrapper` in `WrapperArray` DOM node or `vm` matches [selector](../selectors.md).
6+
37
- **Arguments:**
48
- `{string|Component} selector`
59

610
- **Returns:** `{boolean}`
711

8-
- **Usage:**
9-
10-
Assert every `Wrapper` in `WrapperArray` DOM node or `vm` matches [selector](/docs/en/api/selectors.md).
12+
- **Example:**
1113

1214
```js
1315
import { mount } from 'vue-test-utils'

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# isEmpty()
22

3-
- **Returns:** `{boolean}`
4-
53
- **Usage:**
64

75
Assert every `Wrapper` in `WrapperArray` does not contain child node.
86

7+
- **Returns:** `{boolean}`
8+
9+
- **Example:**
10+
911
```js
1012
import { mount } from 'vue-test-utils'
1113
import { expect } from 'chai'

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# isVueInstance()
22

3-
- **Returns:** `{boolean}`
4-
53
- **Usage:**
64

75
Assert every `Wrapper` in `WrapperArray` is Vue instance.
86

7+
- **Returns:** `{boolean}`
8+
9+
- **Example:**
10+
911
```js
1012
import { mount } from 'vue-test-utils'
1113
import { expect } from 'chai'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# setData(data)
22

3-
- **Arguments:**
4-
- `{Object} data`
5-
63
- **Usage:**
74

85
Sets `Wrapper` `vm` data and forces update on each `Wrapper` in `WrapperArray`.
96

107
**Note every `Wrapper` must contain a Vue instance.**
118

9+
- **Arguments:**
10+
- `{Object} data`
11+
12+
- **Example:**
13+
1214
```js
1315
import { mount } from 'vue-test-utils'
1416
import { expect } from 'chai'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11

22
# setMethods(methods)
33

4-
- **Arguments:**
5-
- `{Object} methods`
6-
74
- **Usage:**
85

96
Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`.
107

118
**Note every `Wrapper` must contain a Vue instance.**
129

10+
- **Arguments:**
11+
- `{Object} methods`
12+
13+
- **Example:**
14+
1315
```js
1416
import { mount } from 'vue-test-utils'
1517
import { expect } from 'chai'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# setProps(props)
22

3-
- **Arguments:**
4-
- `{Object} props`
5-
63
- **Usage:**
74

85
Sets `Wrapper` `vm` props and forces update on each `Wrapper` in `WrapperArray`.
96

107
**Note every `Wrapper` must contain a Vue instance.**
118

9+
- **Arguments:**
10+
- `{Object} props`
11+
12+
- **Example:**
13+
1214
```js
1315
import { mount } from 'vue-test-utils'
1416
import { expect } from 'chai'

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# trigger(eventName)
22

3-
- **Arguments:**
4-
- `{string} eventName
5-
63
- **Usage:**
74

85
Triggers an event on every `Wrapper` in the `WrapperArray` DOM node.
96

107
**Note every `Wrapper` must contain a Vue instance.**
118

9+
- **Arguments:**
10+
- `{string} eventName`
11+
12+
- **Example:**
13+
1214
```js
1315
import { mount } from 'vue-test-utils'
1416
import { expect } from 'chai'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Force root Vue component of each `Wrapper` in `WrapperArray` to re-render.
66

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

9-
### Example
9+
- **Example:**
1010

1111
```js
1212
import { mount } from 'vue-test-utils'

docs/en/api/wrapper/contains.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# contains(selector)
22

3+
- **Usage:**
4+
5+
Assert `Wrapper` contains an element or component matching [selector](../selectors.md).
6+
37
- **Arguments:**
48
- `{string|Component} selector`
59

610
- **Returns:** `{boolean}`
711

8-
- **Usage:**
9-
10-
Assert `Wrapper` contains an element or component matching [selector](/docs/en/api/selectors.md).
12+
- **Example:**
1113

1214
```js
1315
import { mount } from 'vue-test-utils'
@@ -20,4 +22,4 @@ expect(wrapper.contains('p')).to.equal(true)
2022
expect(wrapper.contains(Bar)).to.equal(true)
2123
```
2224

23-
- **See also:** [selectors](/docs/en/api/selectors.md)
25+
- **See also:** [selectors](../selectors.md)

0 commit comments

Comments
 (0)