Skip to content

Commit 64aaafc

Browse files
committed
fix typos
1 parent f021f34 commit 64aaafc

12 files changed

+20
-20
lines changed

src/composition-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ Again, entirely uninteresting - we `trigger` the click event, and assert that th
120120

121121
## Conclusion
122122

123-
The article demonstrates how testing a component using the Composition API is identical to testing one using the traditional options API. The ideas and concepts are the same. The main point to be learned is when writing tests, make asserions based on inputs and outputs.
123+
The article demonstrates how testing a component using the Composition API is identical to testing one using the traditional options API. The ideas and concepts are the same. The main point to be learned is when writing tests, make assertions based on inputs and outputs.
124124

125-
It should be possible to refactor any traditional Vue component to use the Composition API without the need to change the unit tests. If you find yourself needing to change your tests when refactoring, you are likely testing the *implmentation*, not the output.
125+
It should be possible to refactor any traditional Vue component to use the Composition API without the need to change the unit tests. If you find yourself needing to change your tests when refactoring, you are likely testing the *implementation*, not the output.
126126

127127
While an exciting new feature, the Composition API is entirely additive, so there is no immediate need to use it, however regardless of your choice, remember a good unit tests asserts the final state of the component, without considering the implementation details.

src/finding-elements-and-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Find the Vue.js 3 version [here](/v3/).
66

77
`vue-test-utils` provides a number of ways to find and assert the presence of html elements or other Vue components using the `find` and `findComponent` methods. The main use of `find` is asserting a component correctly renders an element or child component.
88

9-
> Note: If you used Vue Test Utils prior to v1, you may remember `find` working with components as well as DOM elements. Now you use `find` and `findAll` for DOM elements, and `findComponent` and `findAllComponents` for Vue components. Ther is also a `get` and `getComponent` pair, which are exactly the same as `find` and `findComponent`, but they will raise an error if they do not find anything. This guide chooses to use `find` and `findComponent`.
9+
> Note: If you used Vue Test Utils prior to v1, you may remember `find` working with components as well as DOM elements. Now you use `find` and `findAll` for DOM elements, and `findComponent` and `findAllComponents` for Vue components. There is also a `get` and `getComponent` pair, which are exactly the same as `find` and `findComponent`, but they will raise an error if they do not find anything. This guide chooses to use `find` and `findComponent`.
1010
1111
The source code for the test described on this page can be found [here](https://github.com/lmiller1990/vue-testing-handbook/tree/master/demo-app/tests/unit/Parent.spec.js).
1212

src/simulating-user-input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ In this section, we saw how to:
277277

278278
- use `trigger` on events, even ones that use modifiers like `prevent`
279279
- use `setValue` to set a value of an `<input>` using `v-model`
280-
- use `await` with `trigger` and `setValue` to `await Vue.nextTick` ane ensure the DOM has updated
280+
- use `await` with `trigger` and `setValue` to `await Vue.nextTick` and ensure the DOM has updated
281281
- write tests using the three steps of unit testing
282282
- mock a method attached to `Vue.prototype` using the `mocks` mounting option
283283
- how to use `flush-promises` to immediately resolve all promises, a useful technique in unit testing

src/v3/composition-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ Again, entirely uninteresting - we `trigger` the click event, and assert that th
112112

113113
## Conclusion
114114

115-
The article demonstrates how testing a component using the Composition API is identical to testing one using the traditional options API. The ideas and concepts are the same. The main point to be learned is when writing tests, make asserions based on inputs and outputs.
115+
The article demonstrates how testing a component using the Composition API is identical to testing one using the traditional options API. The ideas and concepts are the same. The main point to be learned is when writing tests, make assertions based on inputs and outputs.
116116

117-
It should be possible to refactor any traditional Vue component to use the Composition API without the need to change the unit tests. If you find yourself needing to change your tests when refactoring, you are likely testing the *implmentation*, not the output.
117+
It should be possible to refactor any traditional Vue component to use the Composition API without the need to change the unit tests. If you find yourself needing to change your tests when refactoring, you are likely testing the *implementation*, not the output.
118118

119119
While an exciting new feature, the Composition API is entirely additive, so there is no immediate need to use it, however regardless of your choice, remember a good unit tests asserts the final state of the component, without considering the implementation details.

src/v3/finding-elements-and-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Find the Vue.js 2 version [here](/).
66

77
`vue-test-utils` provides a number of ways to find and assert the presence of html elements or other Vue components using the `find` and `findComponent` methods. The main use of `find` is asserting a component correctly renders an element or child component.
88

9-
> Note: If you used Vue Test Utils prior to v1, you may remember `find` working with components as well as DOM elements. Now you use `find` and `findAll` for DOM elements, and `findComponent` and `findAllComponents` for Vue components. Ther is also a `get` and `getComponent` pair, which are exactly the same as `find` and `findComponent`, but they will raise an error if they do not find anything. This guide chooses to use `find` and `findComponent`.
9+
> Note: If you used Vue Test Utils prior to v1, you may remember `find` working with components as well as DOM elements. Now you use `find` and `findAll` for DOM elements, and `findComponent` and `findAllComponents` for Vue components. There is also a `get` and `getComponent` pair, which are exactly the same as `find` and `findComponent`, but they will raise an error if they do not find anything. This guide chooses to use `find` and `findComponent`.
1010
1111
The source code for the test described on this page can be found [here](https://github.com/lmiller1990/vue-testing-handbook/tree/master/demo-app-vue-3/tests/unit/Parent.spec.js).
1212

src/v3/simulating-user-input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ In this section, we saw how to:
281281

282282
- use `trigger` on events, even ones that use modifiers like `prevent`
283283
- use `setValue` to set a value of an `<input>` using `v-model`
284-
- use `await` with `trigger` and `setValue` to `await Vue.nextTick` ane ensure the DOM has updated
284+
- use `await` with `trigger` and `setValue` to `await Vue.nextTick` and ensure the DOM has updated
285285
- write tests using the three steps of unit testing
286286
- mock a method attached to `Vue.prototype` using the `global.mocks` mounting option
287287
- how to use `flush-promises` to immediately resolve all promises, a useful technique in unit testing

src/v3/vue-router.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Finally, note we are using `mount`. If we use `shallowMount`, `<router-link>` wi
127127

128128
Using `mount` is fine in some cases, but sometimes it is not ideal. For example, if you are rendering your entire `<App>` component, chances are the render tree is large, containing many components with their own children components and so on. A lot of children components will trigger various lifecycle hooks, making API requests and the such.
129129

130-
If you are using Jest, its powerful mocking system provides an elegent solution to this problem. You can simply mock the child components, in this case `<NestedRoute>`. The following mock can be used and the above test will still pass:
130+
If you are using Jest, its powerful mocking system provides an elegant solution to this problem. You can simply mock the child components, in this case `<NestedRoute>`. The following mock can be used and the above test will still pass:
131131

132132
```js
133133
jest.mock("@/components/NestedRoute.vue", () => ({
@@ -222,7 +222,7 @@ Vue Router provides several types of router hooks, called ["navigation guards"](
222222
1. Global guards (`router.beforeEach`). Declared on the router instance.
223223
2. In component guards, such as `beforeRouteEnter`. Declared in components.
224224

225-
Making sure these behave correctly is usually a job for an integration test, since you need to have a user navigate from one route to another. However, you can also use unit tests to see if the functions called in the navigation guards are working correctly and get faster feedback about potential bugs. Here are some strategies on decoupling logic from nagivation guards, and writing unit tests around them.
225+
Making sure these behave correctly is usually a job for an integration test, since you need to have a user navigate from one route to another. However, you can also use unit tests to see if the functions called in the navigation guards are working correctly and get faster feedback about potential bugs. Here are some strategies on decoupling logic from navigation guards, and writing unit tests around them.
226226

227227
## Global Guards
228228

src/v3/vuex-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The source code for the test described on this page can be found [here](https://
1313
We will write an action that follows a common Vuex pattern:
1414

1515
1. make an asynchronous call to an API
16-
2. do some proccessing on the data (optional)
16+
2. do some processing on the data (optional)
1717
3. commit a mutation with the result as the payload
1818

1919
This is an `authenticate` action, which sends a username and password to an external API to check if they are a match. The result is then used to update the state by committing a `SET_AUTHENTICATED` mutation with the result as the payload.

src/v3/vuex-in-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Now all the required data is contained in the test. Great! I like this. The test
172172

173173
## The `mapState` and `mapGetters` helper
174174

175-
The above techniques all work in conjuction with Vuex's `mapState` and `mapGetters` helpers. We can update `ComponentWithGetters` to the following:
175+
The above techniques all work in conjunction with Vuex's `mapState` and `mapGetters` helpers. We can update `ComponentWithGetters` to the following:
176176

177177
```js
178178
import { mapGetters } from "vuex"
@@ -198,6 +198,6 @@ This guide discussed:
198198
- how to test `$store.state` and `getters`
199199
- using the `global.mocks` mounting option to mock `$store.state` and `getters`
200200

201-
Techniques to test the implentation of Vuex getters in isolation can be found in [this guide](https://lmiller1990.github.io/vue-testing-handbook/vuex-getters.html).
201+
Techniques to test the implementation of Vuex getters in isolation can be found in [this guide](https://lmiller1990.github.io/vue-testing-handbook/vuex-getters.html).
202202

203203
The source code for the test described on this page can be found [here](https://github.com/lmiller1990/vue-testing-handbook/tree/master/demo-app-vue-3/tests/unit/ComponentWithVuex.spec.js).

src/vue-router.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Vue.use(VueRouter)
7272
export default new VueRouter({ routes })
7373
```
7474

75-
Since we do not want to polluate the global namespace by calling `Vue.use(...)` in our tests, we will create the router on a test by test basis. This will let us have more fine grained control over the state of the application during the unit tests.
75+
Since we do not want to pollute the global namespace by calling `Vue.use(...)` in our tests, we will create the router on a test by test basis. This will let us have more fine-grained control over the state of the application during the unit tests.
7676

7777
## Writing the Test
7878

@@ -173,7 +173,7 @@ Another notable point that is different from other guides in this book is we are
173173

174174
Using `mount` is fine in some cases, but sometimes it is not ideal. For example, if you are rendering your entire `<App>` component, chances are the render tree is large, containing many components with their own children components and so on. A lot of children components will trigger various lifecycle hooks, making API requests and the such.
175175

176-
If you are using Jest, its powerful mocking system provides an elegent solution to this problem. You can simply mock the child components, in this case `<NestedRoute>`. The following mock can be used and the above test will still pass:
176+
If you are using Jest, its powerful mocking system provides an elegant solution to this problem. You can simply mock the child components, in this case `<NestedRoute>`. The following mock can be used and the above test will still pass:
177177

178178
```js
179179
jest.mock("@/components/NestedRoute.vue", () => ({
@@ -266,7 +266,7 @@ Vue Router provides several types of router hooks, called ["navigation guards"](
266266
1. Global guards (`router.beforeEach`). Declared on the router instance.
267267
2. In component guards, such as `beforeRouteEnter`. Declared in components.
268268

269-
Making sure these behave correctly is usually a job for an integration test, since you need to have a user navigate from one route to another. However, you can also use unit tests to see if the functions called in the navigation guards are working correctly and get faster feedback about potential bugs. Here are some strategies on decoupling logic from nagivation guards, and writing unit tests around them.
269+
Making sure these behave correctly is usually a job for an integration test, since you need to have a user navigate from one route to another. However, you can also use unit tests to see if the functions called in the navigation guards are working correctly and get faster feedback about potential bugs. Here are some strategies on decoupling logic from navigation guards, and writing unit tests around them.
270270

271271
## Global Guards
272272

src/vuex-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The source code for the test described on this page can be found [here](https://
1313
We will write an action that follows a common Vuex pattern:
1414

1515
1. make an asynchronous call to an API
16-
2. do some proccessing on the data (optional)
16+
2. do some processing on the data (optional)
1717
3. commit a mutation with the result as the payload
1818

1919
This is an `authenticate` action, which sends a username and password to an external API to check if they are a match. The result is then used to update the state by committing a `SET_AUTHENTICATED` mutation with the result as the payload.

src/vuex-in-components.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ it("renders a username using a real Vuex getter", () => {
132132
})
133133
```
134134

135-
The test is very compact - just two lines of code. There is a lot of setup involved, however - we are bascially rebuilding the Vuex store. An alternative is to import the real Vuex store, with the actual getter. This introduces another dependency to the test though, and when developing a large system, it's possible the Vuex store might be being developed by another programmer, and has not been implemented yet.
135+
The test is very compact - just two lines of code. There is a lot of setup involved, however - we are basically rebuilding the Vuex store. An alternative is to import the real Vuex store, with the actual getter. This introduces another dependency to the test though, and when developing a large system, it's possible the Vuex store might be being developed by another programmer, and has not been implemented yet.
136136

137137
Let's see how we can write the test using the `mocks` mounting option:
138138

@@ -176,7 +176,7 @@ This is more concise than the two previous tests, and still expresses the compon
176176

177177
## The `mapState` and `mapGetters` helper
178178

179-
The above techniques all work in conjuction with Vuex's `mapState` and `mapGetters` helpers. We can update `ComponentWithGetters` to the following:
179+
The above techniques all work in conjunction with Vuex's `mapState` and `mapGetters` helpers. We can update `ComponentWithGetters` to the following:
180180

181181
```js
182182
import { mapGetters } from "vuex"
@@ -202,6 +202,6 @@ This guide discussed:
202202
- using the `mocks` mounting option to mock `$store.state` and `getters`
203203
- using the `computed` mounting option to set the desired value of a Vuex getter
204204

205-
Techniques to test the implentation of Vuex getters in isolation can be found in [this guide](https://lmiller1990.github.io/vue-testing-handbook/vuex-getters.html).
205+
Techniques to test the implementation of Vuex getters in isolation can be found in [this guide](https://lmiller1990.github.io/vue-testing-handbook/vuex-getters.html).
206206

207207
The source code for the test described on this page can be found [here](https://github.com/lmiller1990/vue-testing-handbook/tree/master/demo-app/tests/unit/ComponentWithVuex.spec.js).

0 commit comments

Comments
 (0)