Skip to content

Commit 66e191b

Browse files
authored
Merge pull request #295 from vuejs/port-docs-vitepress
docs: Port docs to this repo (and move to vitepress)
2 parents d41adb2 + c936f14 commit 66e191b

29 files changed

+4828
-646
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [10.x, 12.x, 14.x, 15.x]
19+
node-version: [12.x, 14.x, 15.x]
2020

2121
steps:
2222
- uses: actions/checkout@v2

README.md

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The next iteration of Vue Test Utils. It targets Vue 3.
77
- yarn: `yarn add @vue/test-utils@next --dev`
88
- npm: `npm install @vue/test-utils@next --save-dev`
99

10+
Get started with the [documentation](https://vue-test-utils.vuejs.org/v2/).
11+
1012
## Coming from Vue 2 + Vue Test Utils?
1113

1214
We are working on [some documentation to help people migrate](https://vue-test-utils.vuejs.org/v2/guide/migration.html).
@@ -19,27 +21,23 @@ There is [`vue-jest`](https://github.com/vuejs/vue-jest) for loading `.vue` file
1921

2022
If you don't want to configure things, you can download a repository with Vue 3, `@vue/test-utils@next`, `vue-jest@next` and TypeScript configured [here](https://github.com/lmiller1990/vtu-next-demo).
2123

22-
## Docs
24+
## What works?
2325

24-
Docs are located in [this repo](https://github.com/vuejs/vue-test-utils-next-docs). Read them [here](https://vue-test-utils.vuejs.org/v2/). They are in a separate repository because running Vuepress alongside a repo with Vue 3 causes conflicts - Vuepress expects to be running against Vue 2. This seems like the most simple solution for now.
26+
See the [docs](https://vuejs.github.io/vue-test-utils-next-docs/guide/introduction.html).
2527

2628
## Development
2729

2830
It's a pretty small codebase at the moment. Get started by running `yarn install`. You can run the tests with `yarn test`. That's it!
2931

3032
There is still some work left to do. See issues for some basic TODOs, or the table at the bottom of this page.
3133

32-
## What works?
33-
34-
See the [docs](https://vuejs.github.io/vue-test-utils-next-docs/guide/introduction.html).
35-
3634
## Contributing
3735

3836
This is still quite alpha, but we plan on moving to RC sooner than later. If you want to add a feature, have a hack or ping someone in Discord to chat, or check out the issues and project board.
3937

4038
There's also some [work left to do in docs](https://github.com/vuejs/vue-test-utils-next-docs/issues).
4139

42-
## Comparsion with Vue Test Utils beta (targeting Vue 2)
40+
## Comparison with Vue Test Utils beta (targeting Vue 2)
4341

4442
This is table for those coming from VTU 1, comparing the two APIs. Some things are still a work in progress.
4543

@@ -49,54 +47,53 @@ This is table for those coming from VTU 1, comparing the two APIs. Some things a
4947

5048
### Mounting Options
5149

52-
| option | status | notes |
53-
|---------|-------|------|
54-
data | ✅
55-
slots | ✅ | has not been tested vigorously. Please try it out.
56-
mocks | ✅ | nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global)
57-
propsData | ✅ | now called `props`
58-
provide | ✅ | nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global)
59-
mixins | ✅ | (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global)
60-
plugins | ✅ | (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global)
61-
component | ✅ | (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global)
62-
directives | ✅ | (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global)
63-
stubs | ✅
64-
attachToDocument |✅| renamed `attachTo`. See [here](https://github.com/vuejs/vue-test-utils/pull/1492)
65-
attrs | ✅
66-
scopedSlots | ⚰️ | scopedSlots are merged with slots in Vue 3
67-
context | ⚰️ | different from Vue 2, does not make sense anymore.
68-
localVue | ⚰️ | may not make sense anymore since we do not mutate the global Vue instance in Vue 3.
69-
listeners | ⚰️ | no longer exists in Vue 3
70-
parentComponent | ⚰️ |
71-
50+
| option | status | notes |
51+
| ---------------- | ------ | ----------------------------------------------------------------------------------------- |
52+
| data ||
53+
| slots || has not been tested vigorously. Please try it out. |
54+
| mocks || nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global) |
55+
| propsData || now called `props` |
56+
| provide || nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global) |
57+
| mixins || (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global) |
58+
| plugins || (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global) |
59+
| component || (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global) |
60+
| directives || (new!) nested in [`global`](https://vuejs.github.io/vue-test-utils-next-docs/api/#global) |
61+
| stubs ||
62+
| attachToDocument || renamed `attachTo`. See [here](https://github.com/vuejs/vue-test-utils/pull/1492) |
63+
| attrs ||
64+
| scopedSlots | ⚰️ | scopedSlots are merged with slots in Vue 3 |
65+
| context | ⚰️ | different from Vue 2, does not make sense anymore. |
66+
| localVue | ⚰️ | may not make sense anymore since we do not mutate the global Vue instance in Vue 3. |
67+
| listeners | ⚰️ | no longer exists in Vue 3 |
68+
| parentComponent | ⚰️ |
7269

7370
### Wrapper API (mount)
7471

75-
| method | status | notes |
76-
|---------|-------|------|
77-
attributes | ✅
78-
classes | ✅
79-
exists | ✅
80-
find | ✅ | only `querySelector` syntax is supported. `find(Comp)` under discussion [here](https://github.com/vuejs/vue-test-utils/issues/1498)
81-
emitted | ✅
82-
findAll | ✅ | see above. `.vm` is different to Vue 2. We are exploring options.
83-
get | ✅
84-
html | ✅
85-
setValue | ✅ | works for select, checkbox, radio button, input, textarea. Returns `nextTick`.
86-
text | ✅ |
87-
trigger | ✅ | returns `nextTick`. You can do `await wrapper.find('button').trigger('click')`
88-
setProps | ✅ |
89-
props | ✅
90-
setData | ✅ |
91-
destroy | ✅ | renamed to `unmount` to match Vue 3 lifecycle hook name.
92-
props | ✅
93-
isVisible | ✅
94-
contains | ⚰️| use `find`
95-
emittedByOrder | ⚰️ | use `emitted`
96-
setSelected | ⚰️ | now part of `setValue`
97-
setChecked | ⚰️| now part of `setValue`
98-
is | ⚰️
99-
isEmpty | ⚰️ | use matchers such as [this](https://github.com/testing-library/jest-dom#tobeempty)
100-
isVueInstance | ⚰️
101-
name | ⚰️ |
102-
setMethods | ⚰️ |
72+
| method | status | notes |
73+
| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
74+
| attributes | |
75+
| classes | |
76+
| exists | |
77+
| find | | only `querySelector` syntax is supported. `find(Comp)` under discussion [here](https://github.com/vuejs/vue-test-utils/issues/1498) |
78+
| emitted | |
79+
| findAll | | see above. `.vm` is different to Vue 2. We are exploring options. |
80+
| get | |
81+
| html | |
82+
| setValue | | works for select, checkbox, radio button, input, textarea. Returns `nextTick`. |
83+
| text | |
84+
| trigger | | returns `nextTick`. You can do `await wrapper.find('button').trigger('click')` |
85+
| setProps | |
86+
| props | |
87+
| setData | |
88+
| destroy | | renamed to `unmount` to match Vue 3 lifecycle hook name. |
89+
| props | |
90+
| isVisible | |
91+
| contains | ⚰️ | use `find` |
92+
| emittedByOrder | ⚰️ | use `emitted` |
93+
| setSelected | ⚰️ | now part of `setValue` |
94+
| setChecked | ⚰️ | now part of `setValue` |
95+
| is | ⚰️ |
96+
| isEmpty | ⚰️ | use matchers such as [this](https://github.com/testing-library/jest-dom#tobeempty) |
97+
| isVueInstance | ⚰️ |
98+
| name | ⚰️ |
99+
| setMethods | ⚰️ |

docs/.vitepress/config.js

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/** @typedef {import('vitepress').UserConfig} UserConfig */
2+
3+
/** @type {UserConfig} */
4+
const config = {
5+
// base: '/v2/',
6+
title: 'Vue Test Utils for Vue 3',
7+
description: 'The documentation for the official Vue Test Utils',
8+
locales: {
9+
'/': {
10+
lang: 'en-US',
11+
title: 'Vue Test Utils (2.0.0-beta.14)'
12+
}
13+
},
14+
head: [['link', { rel: 'icon', href: `/logo.png` }]],
15+
themeConfig: {
16+
repo: 'vuejs/vue-test-utils-next',
17+
docsRepo: 'vuejs/vue-test-utils-next',
18+
docsDir: 'docs',
19+
docsBranch: 'master',
20+
editLinks: true,
21+
nav: [
22+
{ text: 'Guide', link: '/introduction/' },
23+
{ text: 'API Reference', link: '/api/' },
24+
{ text: 'Migrating from Vue 2', link: '/migration/' },
25+
{
26+
text: 'Changelog',
27+
link: 'https://github.com/vuejs/vue-test-utils-next/releases'
28+
}
29+
],
30+
sidebar: [
31+
{
32+
text: 'Introduction',
33+
link: '/introduction/'
34+
},
35+
{
36+
text: 'Installation',
37+
link: '/installation/'
38+
},
39+
{
40+
text: 'Essentials',
41+
collapsable: false,
42+
children: [
43+
{ text: 'A Crash Course', link: '/guide/essentials/a-crash-course' },
44+
{
45+
text: 'Conditional Rendering',
46+
link: '/guide/essentials/conditional-rendering'
47+
},
48+
{
49+
text: 'Testing Emitted Events',
50+
link: '/guide/essentials/event-handling'
51+
},
52+
{ text: 'Testing Forms', link: '/guide/essentials/forms' },
53+
{
54+
text: 'Passing Data to Components',
55+
link: '/guide/essentials/passing-data'
56+
}
57+
]
58+
},
59+
{
60+
text: 'Vue Test Utils in depth',
61+
collapsable: false,
62+
children: [
63+
{ text: 'Slots', link: '/guide/advanced/slots' },
64+
{
65+
text: 'Asynchronous Behavior',
66+
link: '/guide/advanced/async-suspense'
67+
},
68+
{
69+
text: 'Making HTTP Requests',
70+
link: '/guide/advanced/http-requests'
71+
},
72+
{ text: 'Transitions', link: '/guide/advanced/transitions' },
73+
{
74+
text: 'Component Instance',
75+
link: '/guide/advanced/component-instance'
76+
},
77+
{
78+
text: 'Reusability and Composition',
79+
link: '/guide/advanced/reusability-composition'
80+
},
81+
{ text: 'Testing Vuex', link: '/guide/advanced/vuex' },
82+
{ text: 'Testing Vue Router', link: '/guide/advanced/vue-router' },
83+
{
84+
text: 'Third-party integration',
85+
link: '/guide/advanced/third-party'
86+
},
87+
{
88+
text: 'Stubs and Shallow Mount',
89+
link: '/guide/advanced/stubs-shallow-mount'
90+
}
91+
]
92+
},
93+
{
94+
text: 'Extending Vue Test Utils',
95+
collapsable: false,
96+
children: [
97+
{ text: 'Plugins', link: '/guide/extending-vtu/plugins' },
98+
{
99+
text: 'Community and Learning',
100+
link: '/guide/extending-vtu/community-learning'
101+
}
102+
]
103+
},
104+
{
105+
text: 'Migrating from Vue 2',
106+
link: '/migration/'
107+
},
108+
{
109+
text: 'API Reference',
110+
link: '/api/'
111+
}
112+
]
113+
}
114+
}
115+
116+
module.exports = config

0 commit comments

Comments
 (0)