Skip to content

Commit ac4f82f

Browse files
Jinjiangeddyerburgh
authored andcommitted
docs: fix typos and formattings (#190)
* [en] typo * typo * typo * [en] typo * [en] updated contents * typo * [en] typo + format * [en] typo
1 parent 6f5f1b0 commit ac4f82f

24 files changed

+108
-92
lines changed

docs/en/api/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* [emitted](./wrapper/emitted.md)
1818
* [emittedByOrder](./wrapper/emittedByOrder.md)
1919
* [find](./wrapper/find.md)
20+
* [findAll](./wrapper/findAll.md)
2021
* [hasAttribute](./wrapper/hasAttribute.md)
2122
* [hasClass](./wrapper/hasClass.md)
2223
* [hasProp](./wrapper/hasProp.md)
@@ -26,11 +27,14 @@
2627
* [isEmpty](./wrapper/isEmpty.md)
2728
* [isVueInstance](./wrapper/isVueInstance.md)
2829
* [name](./wrapper/name.md)
29-
* [update](./wrapper/update.md)
30+
* [setComputed](./wrapper/setComputed.md)
3031
* [setData](./wrapper/setData.md)
32+
* [setMethods](./wrapper/setMethods.md)
3133
* [setProps](./wrapper/setProps.md)
3234
* [text](./wrapper/text.md)
3335
* [trigger](./wrapper/trigger.md)
36+
* [update](./wrapper/update.md)
37+
* [destroy](./wrapper/destroy.md)
3438
* [WrapperArray](./wrapper-array/README.md)
3539
* [at](./wrapper-array/at.md)
3640
* [contains](./wrapper-array/contains.md)
@@ -41,9 +45,16 @@
4145
* [is](./wrapper-array/is.md)
4246
* [isEmpty](./wrapper-array/isEmpty.md)
4347
* [isVueInstance](./wrapper-array/isVueInstance.md)
44-
* [update](./wrapper-array/update.md)
48+
* [setComputed](./wrapper-array/setComputed.md)
4549
* [setData](./wrapper-array/setData.md)
50+
* [setMethods](./wrapper-array/setMethods.md)
4651
* [setProps](./wrapper-array/setProps.md)
4752
* [trigger](./wrapper-array/trigger.md)
53+
* [update](./wrapper-array/update.md)
54+
* [destroy](./wrapper-array/destroy.md)
55+
* [components](./components/README.md)
56+
* [TransitionStub](./components/TransitionStub.md)
57+
* [TransitionGroupStub](./components/TransitionGroupStub.md)
4858
* [createLocalVue](./createLocalVue.md)
4959
* [Selectors](./selectors.md)
60+
* [config](./config.md)

docs/en/api/components/TransitionGroupStub.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
A component to stub the `transition-group` wrapper component. Instead of performing transitions asynchronously, it returns the child components synchronously.
44

5-
This is set to stub all `transition-group` components by default in the vue-test-utils config. To use the built-in `transition-group` wrapper component set `config.stubs[transition-group]` to false:
5+
This is set to stub all `transition-group` components by default in the `vue-test-utils` config. To use the built-in `transition-group` wrapper component set `config.stubs['transition-group']` to false:
66

77
```js
88
import VueTestUtils from 'vue-test-utils'
99

10-
VueTestUtils.config.stubs.transition = false
10+
VueTestUtils.config.stubs['transition-group'] = false
1111
```
1212

1313
To reset it to stub transition components:
14+
1415
```js
1516
import VueTestUtils, { TransitionGroupStub } from 'vue-test-utils'
1617

docs/en/api/createLocalVue.md

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

33
- **Returns:**
44
- `{Component}`
@@ -7,7 +7,7 @@
77

88
`createLocalVue` returns a Vue class for you to add components, mixins and install plugins without polluting the global Vue class.
99

10-
Use it with `options.localVue`
10+
Use it with `options.localVue`:
1111

1212
```js
1313
import { createLocalVue, shallow } from 'vue-test-utils'

docs/en/api/mount.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# mount(component {, options}])
1+
# `mount(component {, options}])`
22

33
- **Arguments:**
44

@@ -31,6 +31,7 @@ describe('Foo', () => {
3131
})
3232
})
3333
```
34+
3435
**With Vue options:**
3536

3637
```js
@@ -80,7 +81,7 @@ describe('Foo', () => {
8081
const wrapper = mount(Foo, {
8182
slots: {
8283
default: [Bar, FooBar],
83-
fooBar: FooBar, // Will match <slot name="FooBar" />,
84+
fooBar: FooBar, // Will match `<slot name="FooBar" />`.
8485
foo: '<div />'
8586
}
8687
})

docs/en/api/options.md

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

77
## `vue-test-utils` Specific Mounting Options
88

9-
- [context](#context)
10-
- [slots](#slots)
11-
- [stubs](#stubs)
12-
- [mocks](#mocks)
13-
- [localVue](#localvue)
14-
- [attachToDocument](#attachtodocument)
15-
- [attrs](#attrs)
16-
- [listeners](#listeners)
17-
- [clone](#clone)
9+
- [`context`](#context)
10+
- [`slots`](#slots)
11+
- [`stubs`](#stubs)
12+
- [`mocks`](#mocks)
13+
- [`localVue`](#localvue)
14+
- [`attachToDocument`](#attachtodocument)
15+
- [`attrs`](#attrs)
16+
- [`listeners`](#listeners)
17+
- [`clone`](#clone)
1818

1919
### `context`
2020

@@ -50,7 +50,7 @@ import Bar from './Bar.vue'
5050
const wrapper = shallow(Component, {
5151
slots: {
5252
default: [Foo, Bar],
53-
fooBar: Foo, // Will match <slot name="FooBar" />,
53+
fooBar: Foo, // Will match `<slot name="FooBar" />`.
5454
foo: '<div />'
5555
}
5656
})
@@ -106,7 +106,7 @@ expect(wrapper.vm.$route.path).toBe($route.path)
106106

107107
- type: `Vue`
108108

109-
A local copy of Vue created by [createLocalVue](./createLocalVue.md) to use when mounting the component. Installing plugins on this copy of Vue prevents polluting the original `Vue` copy.
109+
A local copy of Vue created by [`createLocalVue`](./createLocalVue.md) to use when mounting the component. Installing plugins on this copy of `Vue` prevents polluting the original `Vue` copy.
110110

111111
Example:
112112

@@ -162,4 +162,4 @@ Clones component before mounting if `true`, which avoids mutating the original c
162162

163163
`options.mocks` (`Object`): Add globals to Vue instance.
164164

165-
`options.localVue` (`Object`): vue class to use in `mount`. See [createLocalVue](createLocalVue.md)
165+
`options.localVue` (`Object`): `Vue` class to use in `mount`. See [`createLocalVue`](createLocalVue.md).

docs/en/api/selectors.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@ A lot of methods take a selector as an argument. A selector can either be a CSS
44

55
## CSS Selectors
66

7-
mount handles any valid CSS selector:
7+
Mount handles any valid CSS selector:
88

9-
- tag selectors (div, foo, bar)
10-
- class selectors (.foo, .bar)
11-
- attribute selectors ([foo], [foo="bar"])
12-
- id selectors (#foo, #bar)
13-
- pseudo selectors (div:first-of-type)
9+
- tag selectors (`div`, `foo`, `bar`)
10+
- class selectors (`.foo`, `.bar`)
11+
- attribute selectors (`[foo]`, `[foo="bar"]`)
12+
- id selectors (`#foo`, `#bar`)
13+
- pseudo selectors (`div:first-of-type`)
1414

1515
You can also use combinators:
1616

17-
- direct descendant combinator (div > #bar > .foo)
18-
- general descendant combinator (div #bar .foo)
19-
- adjacent sibling selector (div + .foo)
20-
- general sibling selector (div ~ .foo)
17+
- direct descendant combinator (`div > #bar > .foo`)
18+
- general descendant combinator (`div #bar .foo`)
19+
- adjacent sibling selector (`div + .foo`)
20+
- general sibling selector (`div ~ .foo`)
2121

2222
## Vue Components
2323

2424
Vue components are also valid selectors.
2525

26-
vue-test-utils uses the `name` property to search the instance tree for matching Vue components.
26+
`vue-test-utils` uses the `name` property to search the instance tree for matching Vue components.
2727

2828
```js
2929
// Foo.vue
3030

31-
export default{
31+
export default {
3232
name: 'FooComponent'
3333
}
3434
```
@@ -46,7 +46,7 @@ expect(wrapper.is(Foo)).toBe(true)
4646

4747
### Ref
4848

49-
Using a find option object, vue-test-utils allows for selecting elements by $ref on wrapper components.
49+
Using a find option object, `vue-test-utils` allows for selecting elements by `$ref` on wrapper components.
5050

5151
```js
5252
const buttonWrapper = wrapper.find({ ref: 'myButton' });

docs/en/api/shallow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# shallow(component {, options}])
1+
# `shallow(component {, options}])`
22

33
- **Arguments:**
44

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# WrapperArray
22

3-
A `WrapperArray` is an object that contains an array of [Wrappers](../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

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

99
- **Methods:**
1010

11-
There is a detailed list of methods in the WrapperArray section of the docs.
11+
There is a detailed list of methods in the `WrapperArray` section of the docs.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ const divArray = wrapper.findAll('div')
1414
expect(divArray.contains('p')).toBe(true)
1515
divArray.destroy()
1616
expect(divArray.contains('p')).toBe(false)
17-
1817
```

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Sets `Wrapper` `vm` computed and forces update on each `Wrapper` in `WrapperArray`.
55

66
**Note every `Wrapper` must contain a Vue instance.**
7-
**Note every Vue instance must already have the computed properties passed to setComputed.**
7+
**Note every Vue instance must already have the computed properties passed to `setComputed`.**
88

99
- **Arguments:**
1010
- `{Object} computed properties`

docs/en/api/wrapper/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Wrapper
1+
# `Wrapper`
22

3-
vue-test-utils is a wrapper based API.
3+
`vue-test-utils` is a wrapper based API.
44

55
A `Wrapper` is an object that contains a mounted component or vnode and methods to test the component or vnode.
66

77
- **Properties:**
88

9-
`vm` `Component`: this is the vue instance. You can access all the [instance methods and properties of a vm](https://vuejs.org/v2/api/#Instance-Properties) with `wrapper.vm`. This only exists on Vue component wrappers
9+
`vm` `Component`: this is the `Vue` instance. You can access all the [instance methods and properties of a vm](https://vuejs.org/v2/api/#Instance-Properties) with `wrapper.vm`. This only exists on Vue component wrappers
1010
`element` `HTMLElement`: the root DOM node of the wrapper
11-
`options` `Object`: Object containing vue-test-utils options passed to `mount` or `shallow`
12-
`options.attachedToDom` `Boolean`: True if attachToDom was passed to `mount` or `shallow`
11+
`options` `Object`: Object containing `vue-test-utils` options passed to `mount` or `shallow`
12+
`options.attachedToDom` `Boolean`: True if `attachToDom` was passed to `mount` or `shallow`
1313

1414
- **Methods:**
1515

docs/en/api/wrapper/contains.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# contains(selector)
1+
# `contains(selector)`
22

33
Assert `Wrapper` contains an element or component matching [selector](../selectors.md).
44

docs/en/api/wrapper/hasClass.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Assert `Wrapper` DOM node has class contains `className`.
44

5-
Returns `true` if `Wrapper` DOM node contains class.
5+
Returns `true` if `Wrapper` DOM node contains the class.
66

77
- **Arguments:**
88
- `{string} className`

docs/en/api/wrapper/hasStyle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# hasStyle(style, value)
22

3-
Assert `Wrapper` DOM node has style matching value
3+
Assert `Wrapper` DOM node has style matching value.
44

55
Returns `true` if `Wrapper` DOM node has `style` matching `value`.
66

docs/en/api/wrapper/setComputed.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Sets `Wrapper` `vm` computed property and forces update.
44

55
**Note the Wrapper must contain a Vue instance.**
6-
**Note every Vue instance must already have the computed properties passed to setComputed.**
6+
**Note the Vue instance must already have the computed properties passed to `setComputed`.**
77

88

99
- **Arguments:**

docs/en/api/wrapper/trigger.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Triggers an event on the `Wrapper` DOM node.
44

5-
Trigger takes an optional `options` object. The properties in the `options` object are added to the Event.
5+
`trigger` takes an optional `options` object. The properties in the `options` object are added to the Event.
66

7-
You can run preventDefault on the event by passing `preventDefault: true` in `options`.
7+
You can run `preventDefault` on the event by passing `preventDefault: true` in `options`.
88

99
- **Arguments:**
1010
- `{string} eventName`

docs/en/guides/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* [Getting Started](./getting-started.md)
44
* [Common Tips](./common-tips.md)
5+
* [Mouse, Key and other DOM Events](./dom-events.md)
56
* [Choosing a test runner](./choosing-a-test-runner.md)
67
* [Using with Jest](./using-with-jest.md)
78
* [Testing SFCs with Jest](./testing-SFCs-with-jest.md)

docs/en/guides/choosing-a-test-runner.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ There are a few things to consider when choosing a test runner though: feature s
1212

1313
## Browser Environment
1414

15-
`vue-test-utils` relies on a browser environment. Technically you can run it in a real browser, but it's not recommended due to the complexity of launching real browsers on different platforms. Instead, we recommend running the tests in Node.js with a virtual browser environment using [JSDOM](https://github.com/tmpvar/jsdom).
15+
`vue-test-utils` relies on a browser environment. Technically you can run it in a real browser, but it's not recommended due to the complexity of launching real browsers on different platforms. Instead, we recommend running the tests in Node with a virtual browser environment using [JSDOM](https://github.com/tmpvar/jsdom).
1616

1717
The Jest test runner sets up JSDOM automatically. For other test runners, you can manually set up JSDOM for the tests using [jsdom-global](https://github.com/rstacruz/jsdom-global) in the entry for your tests:
1818

docs/en/guides/common-tips.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ For UI components, we don't recommend aiming for complete line-based coverage, b
66

77
Instead, we recommend writing tests that assert your component's public interface, and treat its internals as a black box. A single test case would assert that some input (user interaction or change of props) provided to the component results in the expected output (render result or emitted custom events).
88

9-
For example, for the `Counter` component which increments a display counter by 1 each time a button is clicked, its test case would simulate the click and assert that the rendered output has increased by 1. The test doesn't care about how the Counter increments the value, it only cares about the input and the output.
9+
For example, for the `Counter` component which increments a display counter by 1 each time a button is clicked, its test case would simulate the click and assert that the rendered output has increased by 1. The test doesn't care about how the `Counter` increments the value, it only cares about the input and the output.
1010

1111
The benefit of this approach is that as long as your component's public interface remains the same, your tests will pass no matter how the component's internal implementation changes over time.
1212

@@ -36,7 +36,7 @@ wrapper.vm.$emit('foo')
3636
wrapper.vm.$emit('foo', 123)
3737

3838
/*
39-
wrapper.emitted() returns the following object:
39+
`wrapper.emitted()` returns the following object:
4040
{
4141
foo: [[], [123]]
4242
}
@@ -58,7 +58,7 @@ expect(wrapper.emitted().foo.length).toBe(2)
5858
expect(wrapper.emitted().foo[1]).toEqual([123])
5959
```
6060

61-
You can also get an Array of the events in their emit order by calling [wrapper.emittedByOrder()](../api/wrapper/emittedByOrder.md).
61+
You can also get an Array of the events in their emit order by calling [`wrapper.emittedByOrder()`](../api/wrapper/emittedByOrder.md).
6262

6363
## Manipulating Component State
6464

@@ -92,26 +92,26 @@ You can also update the props of an already-mounted component with the `wrapper.
9292

9393
Some of the components may rely on features injected by a global plugin or mixin, for example `vuex` and `vue-router`.
9494

95-
If you are writing tests for components in a specific app, you can setup the same global plugins and mixins once in the entry of your tests. But in some cases, for example testing a generic component suite that may get shared across different apps, it's better to test your components in a more isolated setup, without polluting the global `Vue` constructor. We can use the [createLocalVue](../api/createLocalVue.md) method to achieve that:
95+
If you are writing tests for components in a specific app, you can setup the same global plugins and mixins once in the entry of your tests. But in some cases, for example testing a generic component suite that may get shared across different apps, it's better to test your components in a more isolated setup, without polluting the global `Vue` constructor. We can use the [`createLocalVue`](../api/createLocalVue.md) method to achieve that:
9696

9797
``` js
9898
import createLocalVue from 'vue-test-utils'
9999

100-
// create an extended Vue constructor
100+
// create an extended `Vue` constructor
101101
const localVue = createLocalVue()
102102

103103
// install plugins as normal
104104
localVue.use(MyPlugin)
105105

106-
// pass the localVue to the mount options
106+
// pass the `localVue` to the mount options
107107
mount(Component, {
108108
localVue
109109
})
110110
```
111111

112112
## Mocking Injections
113113

114-
Another strategy for injected properties is simply mocking them. You can do that with the `mocks` option:
114+
Another strategy for injected props is simply mocking them. You can do that with the `mocks` option:
115115

116116
```js
117117
import { mount } from 'vue-test-utils'
@@ -125,7 +125,7 @@ const $route = {
125125

126126
mount(Component, {
127127
mocks: {
128-
$route // adds the mocked $route object to the Vue instance before mounting component
128+
$route // adds the mocked `$route` object to the Vue instance before mounting component
129129
}
130130
})
131131
```

0 commit comments

Comments
 (0)