Skip to content

Commit 5b5319d

Browse files
authored
docs: move to VuePress (vuejs#627)
1 parent 8294453 commit 5b5319d

File tree

430 files changed

+3225
-13479
lines changed

Some content is hidden

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

430 files changed

+3225
-13479
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
steps:
1818
- checkout
1919
- *restore_node_modules
20+
- run:
21+
name: remove vuepress from dependencies
22+
command: sed -i '/vuepress/ d' package.json
2023
- run:
2124
name: yarn --version
2225
command: yarn --version

docs/.vuepress/_redirects

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/en/* /:splat
2+
3+
/api/mount /api/#mount
4+
/api/shallowMount /api/#shallowmount
5+
/api/createLocalVue /api/#createlocalvue
6+
/api/config /api/#config
7+
8+
/api/wrapper/* /api/wrapper.html/#:splat
9+
/api/wrapper-array/* /api/wrapper-array.html/#:splat
10+
11+
/ja/api/mount /ja/api/#mount
12+
/ja/api/shallowMount /ja/api/#shallowmount
13+
/ja/api/createLocalVue /ja/api/#createlocalvue
14+
/ja/api/config /ja/api/#config
15+
16+
/ja/api/wrapper/* /ja/api/wrapper.html/#:splat
17+
/ja/api/wrapper/* /ja/api/wrapper.html/#:splat
18+
/ja/api/wrapper-array/* /ja/api/wrapper-array.html/#:splat
19+
20+
/zh/api/mount /zh/api/#mount
21+
/zh/api/shallowMount /zh/api/#shallowmount
22+
/zh/api/createLocalVue /zh/api/#createlocalvue
23+
/zh/api/config /zh/api/#config
24+
25+
/zh/api/wrapper/* /zh/api/wrapper.html/#:splat
26+
/zh/api/wrapper-array/* /zh/api/wrapper-array.html/#:splat

docs/.vuepress/config.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
module.exports = {
2+
locales: {
3+
'/': {
4+
lang: 'en-US',
5+
title: 'Vue Test Utils',
6+
description: 'Utilities for testing Vue components'
7+
},
8+
'/ja/': {
9+
lang: 'ja',
10+
title: 'Vue Test Utils',
11+
description: 'Vue コンポーネントをテストするためのユーティリティ'
12+
},
13+
'/zh/': {
14+
lang: 'zh-CN',
15+
title: 'Vue Test Utils',
16+
description: '测试 Vue 组件的实用工具'
17+
}
18+
},
19+
serviceWorker: true,
20+
theme: 'vue',
21+
themeConfig: {
22+
repo: 'vuejs/vue-test-utils',
23+
docsDir: 'docs',
24+
locales: {
25+
'/': {
26+
label: 'English',
27+
selectText: 'Languages',
28+
editLinkText: 'Edit this page on GitHub',
29+
nav: [
30+
{
31+
text: 'API',
32+
link: '/api/'
33+
},
34+
{
35+
text: 'Guides',
36+
link: '/guides/'
37+
}
38+
],
39+
sidebar: [
40+
'/',
41+
'/guides/',
42+
'/api/',
43+
'/api/wrapper/',
44+
'/api/wrapper-array/',
45+
'/api/options',
46+
'/api/components/'
47+
]
48+
},
49+
'/zh/': {
50+
label: '简体中文',
51+
selectText: '选择语言',
52+
editLinkText: '在 GitHub 上编辑此页',
53+
nav: [
54+
{
55+
text: 'API',
56+
link: '/zh/api/'
57+
},
58+
{
59+
text: '教程',
60+
link: '/zh/guides/'
61+
}
62+
],
63+
sidebar: [
64+
'/zh/',
65+
'/zh/guides/',
66+
'/zh/api/',
67+
'/zh/api/wrapper/',
68+
'/zh/api/wrapper-array/',
69+
'/zh/api/options',
70+
'/zh/api/components/'
71+
]
72+
},
73+
'/ja/': {
74+
label: '日本語',
75+
selectText: '言語',
76+
editLinkText: 'GitHub 上でこのページを編集する',
77+
nav: [
78+
{
79+
text: 'API',
80+
link: '/ja/api/'
81+
},
82+
{
83+
text: 'ガイド',
84+
link: '/ja/guides/'
85+
}
86+
],
87+
sidebar: [
88+
'/ja/',
89+
'/ja/guides/',
90+
'/ja/api/',
91+
'/ja/api/wrapper/',
92+
'/ja/api/wrapper-array/',
93+
'/ja/api/options',
94+
'/ja/api/components/'
95+
]
96+
}
97+
}
98+
},
99+
markdown: {
100+
config: md => {
101+
// use more markdown-it plugins!
102+
md.use(require('markdown-it-include'))
103+
}
104+
}
105+
}

docs/LANGS.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/en/README.md renamed to docs/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
# Vue Test Utils
1+
# Introduction
22

33
Vue Test Utils is the official unit testing utility library for Vue.js.
44

5-
## Table of Contents
6-
7-
* [Guides](guides/README.md)
8-
* [Getting Started](guides/getting-started.md)
5+
* [Guides](./guides/README.md)
6+
* [Getting Started](./guides/getting-started.md)
97
* [Common Tips](guides/common-tips.md)
108
* [Mouse, Key and other DOM Events](guides/dom-events.md)
119
* [Choosing a test runner](guides/choosing-a-test-runner.md)

docs/api/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# API
2+
3+
!!!include(docs/api/mount.md)!!!
4+
!!!include(docs/api/shallowMount.md)!!!
5+
!!!include(docs/api/render.md)!!!
6+
!!!include(docs/api/renderToString.md)!!!
7+
!!!include(docs/api/selectors.md)!!!
8+
!!!include(docs/api/createLocalVue.md)!!!
9+
!!!include(docs/api/config.md)!!!

docs/api/components/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Components
2+
3+
Vue Test Utils includes utility components you can use to stub components.
4+
5+
!!!include(docs/api/components/RouterLinkStub.md)!!!
6+
!!!include(docs/api/components/TransitionStub.md)!!!
7+
!!!include(docs/api/components/TransitionGroupStub.md)!!!

docs/en/api/components/RouterLinkStub.md renamed to docs/api/components/RouterLinkStub.md

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

33
A component to stub the Vue Router `router-link` component.
44

docs/en/api/components/TransitionGroupStub.md renamed to docs/api/components/TransitionGroupStub.md

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

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

@@ -28,4 +28,4 @@ mount(Component, {
2828
'transition-group': TransitionGroupStub
2929
}
3030
})
31-
```
31+
```

docs/en/api/components/TransitionStub.md renamed to docs/api/components/TransitionStub.md

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

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

docs/en/api/config.md renamed to docs/api/config.md

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

33
Vue Test Utils includes a config object to defined options used by Vue Test Utils.
44

5-
## Vue Test Utils Config Options
5+
### Vue Test Utils Config Options
66

77
### `stubs`
88

docs/en/api/createLocalVue.md renamed to docs/api/createLocalVue.md

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

33
- **Returns:**
44
- `{Component}`

docs/en/api/mount.md renamed to docs/api/mount.md

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

33
- **Arguments:**
44

docs/en/api/options.md renamed to docs/api/options.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
Options for `mount` and `shallowMount`. The options object can contain both Vue Test Utils mounting options and other options.
44

5-
## Vue Test Utils Specific Mounting Options
6-
75
- [`context`](#context)
86
- [`slots`](#slots)
97
- [`scopedSlots`](#scopedslots)
@@ -16,7 +14,7 @@ Options for `mount` and `shallowMount`. The options object can contain both Vue
1614
- [`provide`](#provide)
1715
- [`sync`](#sync)
1816

19-
### `context`
17+
## context
2018

2119
- type: `Object`
2220

@@ -38,7 +36,7 @@ const wrapper = mount(Component, {
3836
expect(wrapper.is(Component)).toBe(true)
3937
```
4038

41-
### `slots`
39+
## slots
4240

4341
- type: `{ [name: string]: Array<Component>|Component|string }`
4442

@@ -61,15 +59,15 @@ const wrapper = shallowMount(Component, {
6159
expect(wrapper.find('div')).toBe(true)
6260
```
6361

64-
#### Passing text
62+
### Passing text
6563

6664
You can pass text to `slots`.
6765
There is a limitation to this.
6866

6967
This does not support PhantomJS.
7068
You can use [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer) as an alternative.
7169

72-
### `scopedSlots`
70+
## scopedSlots
7371

7472
- type: `{ [name: string]: string }`
7573

@@ -95,7 +93,7 @@ const wrapper = shallowMount(Component, {
9593
expect(wrapper.find('#fooWrapper').html()).toBe('<div id="fooWrapper"><p>0,text1</p><p>1,text2</p><p>2,text3</p></div>')
9694
```
9795

98-
### `stubs`
96+
## stubs
9997

10098
- type: `{ [name: string]: Component | boolean } | Array<string>`
10199

@@ -120,7 +118,7 @@ shallowMount(Component, {
120118
})
121119
```
122120

123-
### `mocks`
121+
## mocks
124122

125123
- type: `Object`
126124

@@ -138,7 +136,7 @@ const wrapper = shallowMount(Component, {
138136
expect(wrapper.vm.$route.path).toBe($route.path)
139137
```
140138

141-
### `localVue`
139+
## localVue
142140

143141
- type: `Vue`
144142

@@ -169,32 +167,32 @@ const wrapper = mount(Component, {
169167
expect(wrapper.vm.$route).toBeInstanceOf(Object)
170168
```
171169

172-
### `attachToDocument`
170+
## attachToDocument
173171

174172
- type: `boolean`
175173
- default: `false`
176174

177175
Component will be attached to DOM when rendered if set to `true`.
178176

179-
### `attrs`
177+
## attrs
180178

181179
- type: `Object`
182180

183181
Set the component instance's `$attrs` object.
184182

185-
### `listeners`
183+
## listeners
186184

187185
- type: `Object`
188186

189187
Set the component instance's `$listeners` object.
190188

191-
### `provide`
189+
## provide
192190

193191
- type: `Object`
194192

195193
Pass properties for components to use in injection. See [provide/inject](https://vuejs.org/v2/api/#provide-inject).
196194

197-
### `sync`
195+
## sync
198196

199197
- type: `boolean`
200198
- default: `true`

docs/en/api/render.md renamed to docs/api/render.md

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

33
- **Arguments:**
44

docs/en/api/renderToString.md renamed to docs/api/renderToString.md

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

33
- **Arguments:**
44

docs/en/api/selectors.md renamed to docs/api/selectors.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Selectors
1+
## Selectors
22

33
A lot of methods take a selector as an argument. A selector can either be a CSS selector, a Vue component, or a find option object.
44

5-
## CSS Selectors
5+
### CSS Selectors
66

77
Mount handles any valid CSS selector:
88

@@ -19,7 +19,7 @@ You can also use combinators:
1919
- adjacent sibling selector (`div + .foo`)
2020
- general sibling selector (`div ~ .foo`)
2121

22-
## Vue Components
22+
###Vue Components
2323

2424
Vue components are also valid selectors.
2525

@@ -39,9 +39,9 @@ const wrapper = shallowMount(Foo)
3939
expect(wrapper.is(Foo)).toBe(true)
4040
```
4141

42-
## Find Option Object
42+
###Find Option Object
4343

44-
### Name
44+
#### Name
4545

4646
Using a find option object, Vue Test Utils allows for selecting elements by a `name` of component on wrapper components.
4747

@@ -50,7 +50,7 @@ const buttonWrapper = wrapper.find({ name: 'my-button' })
5050
buttonWrapper.trigger('click')
5151
```
5252

53-
### Ref
53+
#### Ref
5454

5555
Using a find option object, Vue Test Utils allows for selecting elements by `$ref` on wrapper components.
5656

0 commit comments

Comments
 (0)