Skip to content

Commit 2284ae5

Browse files
authored
Merge pull request #19 from vuejs/sidebar-proposal
Sidebar proposal for docs
2 parents 551eaaf + bef01d5 commit 2284ae5

18 files changed

+123
-8
lines changed

src/.vuepress/config.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,38 @@ const sidebar = {
77
'/guide/installation',
88
'/guide/introduction',
99
'/guide/a-crash-course',
10-
'/guide/plugins'
10+
'/guide/conditional-rendering',
11+
'/guide/event-handling',
12+
'/guide/passing-data',
13+
'/guide/forms'
1114
]
1215
},
16+
{
17+
title: 'Vue Test Utils in depth',
18+
collapsable: false,
19+
children: [
20+
'/guide/slots',
21+
'/guide/async-suspense',
22+
'/guide/http-requests',
23+
'/guide/transitions',
24+
'/guide/component-instance',
25+
'/guide/reusability-composition',
26+
'/guide/vuex',
27+
'/guide/vue-router',
28+
'/guide/third-party',
29+
'/guide/stubs-shallow-mount'
30+
]
31+
},
32+
{
33+
title: 'Extending Vue Test Utils',
34+
collapsable: false,
35+
children: ['/guide/plugins', '/guide/community-learning']
36+
},
37+
{
38+
title: 'Migration to Vue Test Utils 2',
39+
collapsable: false,
40+
children: ['/guide/migration']
41+
},
1342
{
1443
title: 'API Reference',
1544
collapsable: false,
@@ -44,6 +73,7 @@ module.exports = {
4473
nav: [
4574
{ text: 'Guide', link: '/guide/introduction' },
4675
{ text: 'API Reference', link: '/api/' },
76+
{ text: 'Migration from VTU 1', link: '/guide/migration' },
4777
{ text: 'GitHub', link: 'https://github.com/vuejs/vue-test-utils-next' }
4878
]
4979
}

src/guide/async-suspense.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Suspense and Async Behavior
2+
3+
`async` related stuff. Maybe `flushPromises`?

src/guide/community-learning.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Community and Learning
2+
3+
Links to a future plugin repository
4+
5+
Links to vue testing lib
6+
7+
Links to other resources?

src/guide/component-instance.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Component Instance
2+
3+
Mostly `findComponent()`, `.props()` et al.
4+
5+
Also why `.vm` is not available and yet another recommendation to test outputs instead of implementation details.

src/guide/conditional-rendering.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Conditional Rendering
2+
3+
Mostly `exists()`, `find()`, and `get()`.
4+
5+
Maybe `html()`, `classes()`?

src/guide/event-handling.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Event Handling
2+
3+
Mostly `emitted()`.

src/guide/forms.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Forms
2+
3+
Mostly `setValue()` and `trigger()`.
4+
5+
Also we might want to tackle `v-model`.
6+
7+
https://github.com/vuejs/vue-test-utils-next-docs/issues/4

src/guide/http-requests.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Making HTTP requests
2+
3+
It isn't that tricky, but I feel it is a common pain point.
4+
5+
Mostly `jest.mock()`, `trigger()`.
6+
7+
Also: how to handle HTTP requests from lifecycle hooks (we could add `.unmount()` here).

src/guide/introduction.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ import { mount } from '@vue/test-utils'
1111

1212
const Hello = {
1313
template: '<div>{{ msg }}</div>',
14-
props: {
15-
msg: {
16-
type: String
17-
}
18-
}
14+
props: ['msg'],
1915
}
2016

2117
test('it renders a message', () => {
@@ -24,15 +20,22 @@ test('it renders a message', () => {
2420
msg: 'Hello world'
2521
}
2622
})
27-
23+
2824
expect(wrapper.html()).toContain('Hello world')
2925
})
3026
```
3127

32-
We use the `mount` method to render the `<Hello>` component. The first argument is the component we want to render - in this case, the `<Hello>` component. The second argument is an object of options. We use the `props` mounting option to set the `msg` prop.
28+
We use the `mount` method to render the `<Hello>` component. The first argument is the component we want to render - in this case, the `<Hello>` component. The second argument is an object of options. We use the `props` mounting option to set the `msg` prop.
3329

3430
`mount` returns a "wrapper" - a thin layer around your Vue component, with useful methods such as `html`, which we use to assert that the `msg` prop is rendered correctly.
3531

32+
## Vue and Vue Test Utils
33+
34+
In short:
35+
36+
* Vue Test Utils 1.X targets Vue 2.X.
37+
* Vue Test Utils 2.X targets Vue 3.X.
38+
3639
## What Next?
3740

3841
If you want to see what else Vue Test Utils can do, take the crash course [here](/guide/a-crash-course/), where we use Test Driven Development (TDD) and Vue Test Utils to build a simple Todo app.

src/guide/migration.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Migration
2+
3+
A review of changes VTU 1 -> VTU 2, and some code snippets to showcase required modifications.

src/guide/passing-data.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Passing Data to Components
2+
3+
Mostly mounting with `data()` and `props`.
4+
5+
https://github.com/vuejs/vue-test-utils-next-docs/issues/9
6+
7+
We could also fit a complex use case with `setProps()` (as outlined in the linked issue).

src/guide/reusability-composition.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Reusability & Composition
2+
3+
Mostly:
4+
5+
- `global.provide`.
6+
- `global.mixins`.
7+
- `global.directives`.

src/guide/slots.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Slots
2+
3+
Mostly `slots`.

src/guide/stubs-shallow-mount.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Stubs and Shallow Mount
2+
3+
Mostly `mount({ shallow: true })` and `global.stubs`.

src/guide/third-party.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Third-party Integration
2+
3+
Overall usage of mocking tools such as `jest.mock()`. (Not only *how*, but mostly *why* and *when*).
4+
5+
Also…
6+
7+
* Vuetify
8+
* BootstrapVue
9+
10+
(each of them could be a subpage?)

src/guide/transitions.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Transitions
2+

src/guide/vue-router.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Vue Router
2+
3+
:)
4+
5+
https://github.com/vuejs/vue-test-utils-next-docs/issues/7

src/guide/vuex.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Vuex
2+
3+
:)
4+
5+
https://github.com/vuejs/vue-test-utils-next-docs/issues/8

0 commit comments

Comments
 (0)