Skip to content

Commit 0437e26

Browse files
Jinjiangeddyerburgh
authored andcommitted
docs: zn update (#674)
1 parent a864ed3 commit 0437e26

File tree

14 files changed

+34
-49
lines changed

14 files changed

+34
-49
lines changed

Diff for: docs/api/mount.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,4 @@ describe('Foo', () => {
126126
})
127127
```
128128

129-
- **See also:** [Wrapper](wrapper/README.md)
129+
- **See also:** [Wrapper](wrapper/)

Diff for: docs/api/wrapper/find.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## find(selector)
22

3-
Returns [`Wrapper`](../wrapper/) of first DOM node or Vue component matching selector.
3+
Returns `Wrapper` of first DOM node or Vue component matching selector.
44

55
Use any valid [selector](../selectors.md).
66

@@ -30,5 +30,3 @@ expect(barByName.is(Bar)).toBe(true)
3030
const fooRef = wrapper.find({ ref: 'foo' })
3131
expect(fooRef.is(Foo)).toBe(true)
3232
```
33-
34-
- **See also:** [Wrapper](../wrapper/)

Diff for: docs/api/wrapper/findAll.md

-2
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@ expect(div.is('div')).toBe(true)
2222
const bar = wrapper.findAll(Bar).at(0)
2323
expect(bar.is(Bar)).toBe(true)
2424
```
25-
26-
- **See also:** [Wrapper](../wrapper/)

Diff for: docs/ja/api/wrapper/find.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## find(selector)
22

3-
最初の DOM ノードの [Wrapper](../wrapper/)、またはセレクタで一致した Vue コンポーネントを返します。
3+
最初の DOM ノードの Wrapper、またはセレクタで一致した Vue コンポーネントを返します。
44

55
有効な[セレクタ](../selectors.md)を使用してください。
66

@@ -30,5 +30,3 @@ expect(barByName.is(Bar)).toBe(true)
3030
const fooRef = wrapper.find({ ref: 'foo' })
3131
expect(fooRef.is(Foo)).toBe(true)
3232
```
33-
34-
- **参照:** [Wrapper](../wrapper/)

Diff for: docs/ja/api/wrapper/findAll.md

-2
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@ expect(div.is('div')).toBe(true)
2222
const bar = wrapper.findAll(Bar).at(0)
2323
expect(bar.is(Bar)).toBe(true)
2424
```
25-
26-
- **参照:** [Wrapper](../wrapper/)

Diff for: docs/zh/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。
44

5-
* [教程](guides/README.md)
5+
* [教程](guides/)
66
* [起步](guides/getting-started.md)
77
* [常用技巧](guides/common-tips.md)
88
* [鼠标、键盘以及其它 DOM 事件](guides/dom-events.md)
@@ -13,7 +13,7 @@ Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。
1313
* [测试异步行为](guides/testing-async-components.md)
1414
* [配合 Vue Router 使用](guides/using-with-vue-router.md)
1515
* [配合 Vuex 实用](guides/using-with-vuex.md)
16-
* [API](api/README.md)
16+
* [API](api/)
1717
* [mount](api/mount.md)
1818
* [shallowMount](api/shallowMount.md)
1919
* [render](api/render.md)
@@ -31,7 +31,7 @@ Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。
3131
- [provide](api/options.md#provide)
3232
- [sync](api/options.md#sync)
3333
- [其它选项](api/options.md#other-options)
34-
* [Wrapper](api/wrapper/README.md)
34+
* [Wrapper](api/wrapper/)
3535
* [attributes](api/wrapper/attributes.md)
3636
* [classes](api/wrapper/classes.md)
3737
* [contains](api/wrapper/contains.md)
@@ -53,7 +53,7 @@ Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。
5353
* [text](api/wrapper/text.md)
5454
* [trigger](api/wrapper/trigger.md)
5555
* [isVisible](api/wrapper/isVisible.md)
56-
* [WrapperArray](api/wrapper-array/README.md)
56+
* [WrapperArray](api/wrapper-array/)
5757
* [at](api/wrapper-array/at.md)
5858
* [contains](api/wrapper-array/contains.md)
5959
* [exists](api/wrapper/exists.md)
@@ -67,7 +67,7 @@ Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。
6767
* [setProps](api/wrapper-array/setProps.md)
6868
* [trigger](api/wrapper-array/trigger.md)
6969
* [isVisible](api/wrapper-array/isVisible.md)
70-
* [组件](api/components/README.md)
70+
* [组件](api/components/)
7171
* [TransitionStub](api/components/TransitionStub.md)
7272
* [TransitionGroupStub](api/components/TransitionGroupStub.md)
7373
* [RouterLinkStub](api/components/RouterLinkStub.md)

Diff for: docs/zh/api/mount.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
- **用法:**
1515

16-
创建一个包含被挂载和渲染的 Vue 组件的 [`Wrapper`](wrapper/README.md)
16+
创建一个包含被挂载和渲染的 Vue 组件的 [`Wrapper`](wrapper/)
1717

1818
**Without options:**
1919

@@ -126,4 +126,4 @@ describe('Foo', () => {
126126
})
127127
```
128128

129-
- **延伸阅读:**[`Wrapper`](wrapper/README.md)
129+
- **延伸阅读:**[`Wrapper`](wrapper/)

Diff for: docs/zh/api/options.md

-9
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,12 @@ const wrapper = shallowMount(Component, {
5959
expect(wrapper.find('div')).toBe(true)
6060
```
6161

62-
### 传递文本
63-
64-
你可以传递文本到 `slots`
65-
这里有一处限制。
66-
67-
我们不支持 PhantomJS。
68-
你可以使用 [Puppeteer](https://github.com/karma-runner/karma-chrome-launcher#headless-chromium-with-puppeteer) 作为替代品。
69-
7062
## scopedSlots
7163

7264
- 类型:`{ [name: string]: string }`
7365

7466
提供一个该组件所有带作用域的插槽内容的对象。每个键对应到插槽的名字,每个值可以是一个模板字符串。
7567

76-
There are three limitations.
7768
这里有三处限制。
7869

7970
* 该选项只支持 [email protected]+。

Diff for: docs/zh/api/render.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
将一个对象渲染成为一个字符串并返回一个 [cheerio 包裹器](https://github.com/cheeriojs/cheerio)
2525

26-
Cheerio 是一个类似 jQuery 的库,可以在 Node.js 中游览 DOM 对象。它的 API 和 Vue Test Utils 的 [`Wrapper`](wrapper/README.md) 类似。
26+
Cheerio 是一个类似 jQuery 的库,可以在 Node.js 中游览 DOM 对象。它的 API 和 Vue Test Utils 的 [`Wrapper`](wrapper/) 类似。
2727

2828
`render` 在底层使用 [`vue-server-renderer`](https://ssr.vuejs.org/zh/basic.html) 将一个组件渲染为静态的 HTML。
2929

Diff for: docs/zh/api/shallowMount.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
- **用法:**
2424

25-
[`mount`](mount.md) 一样,创建一个包含被挂载和渲染的 Vue 组件的 [`Wrapper`](wrapper/README.md),不同的是被存根的子组件。
25+
[`mount`](mount.md) 一样,创建一个包含被挂载和渲染的 Vue 组件的 [`Wrapper`](wrapper/),不同的是被存根的子组件。
2626

2727
**无选项:**
2828

Diff for: docs/zh/api/wrapper-array/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# WrapperArray
22

3-
一个 `WrapperArray` 是一个包含 [`Wrapper`](../wrapper/README.md) 数组以及 `Wrapper` 的测试方法等对象。
3+
一个 `WrapperArray` 是一个包含 [`Wrapper`](../wrapper/) 数组以及 `Wrapper` 的测试方法等对象。
44

55
## 属性
66

7-
### `wrappers`
7+
### `wrappers`
88

9-
`array`: 包含在 `WrapperArray` 内的 `Wrappers`
9+
`array`: 包含在 `WrapperArray` 内的 `Wrappers`
1010

11-
### `length`
11+
### `length`
1212

1313
`number`:该 `WrapperArray` 中包含的 `Wrapper` 的数量。
1414

Diff for: docs/zh/api/wrapper/find.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## find(selector)
22

3-
返回匹配选择器的第一个 DOM 节点或 Vue 组件的 [`Wrapper`](README.md)
3+
返回匹配选择器的第一个 DOM 节点或 Vue 组件的 `Wrapper`
44

55
可以使用任何有效的[选择器](../selectors.md)
66

@@ -30,5 +30,3 @@ expect(barByName.is(Bar)).toBe(true)
3030
const fooRef = wrapper.find({ ref: 'foo' })
3131
expect(fooRef.is(Foo)).toBe(true)
3232
```
33-
34-
- **延伸阅读:**[Wrapper](README.md)

Diff for: docs/zh/api/wrapper/findAll.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## findAll(selector)
22

3-
返回一个匹配选择器的 DOM 节点或 Vue 组件的 [`Wrappers`](README.md)[`WrapperArray`](../wrapper-array/README.md)
3+
返回一个 [`WrapperArray`](../wrapper-array/)
44

55
可以使用任何有效的[选择器](../selectors.md)
66

@@ -22,5 +22,3 @@ expect(div.is('div')).toBe(true)
2222
const bar = wrapper.findAll(Bar).at(0)
2323
expect(bar.is(Bar)).toBe(true)
2424
```
25-
26-
- **延伸阅读:**[Wrapper](README.md)

Diff for: docs/zh/guides/using-with-vuex.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
## 配合 Vuex 使用
1+
# 配合 Vuex 使用
22

33
在本教程中,我们将会看到如何用 Vue Test Utils 测试组件中的 Vuex,以及如何测试一个 Vuex store。
44

5+
## 在组件中测试 Vuex
6+
57
### 伪造 Action
68

79
我们来看一些代码。
@@ -214,14 +216,14 @@ export default{
214216
``` js
215217
import { shallowMount, createLocalVue } from '@vue/test-utils'
216218
import Vuex from 'vuex'
217-
import Modules from '../../../src/components/Modules'
218-
import module from '../../../src/store/module'
219+
import MyComponent from '../../../src/components/MyComponent'
220+
import mymodule from '../../../src/store/mymodule'
219221

220222
const localVue = createLocalVue()
221223

222224
localVue.use(Vuex)
223225

224-
describe('Modules.vue', () => {
226+
describe('MyComponent.vue', () => {
225227
let actions
226228
let state
227229
let store
@@ -238,23 +240,27 @@ describe('Modules.vue', () => {
238240
}
239241

240242
store = new Vuex.Store({
241-
state,
242-
actions,
243-
getters: module.getters
243+
modules: {
244+
mymodule: {
245+
state,
246+
actions,
247+
getters: module.getters
248+
}
249+
}
244250
})
245251
})
246252

247253
it('在点击按钮时调用 action“moduleActionClick”', () => {
248-
const wrapper = shallowMount(Modules, { store, localVue })
254+
const wrapper = shallowMount(MyComponent, { store, localVue })
249255
const button = wrapper.find('button')
250256
button.trigger('click')
251257
expect(actions.moduleActionClick).toHaveBeenCalled()
252258
})
253259

254260
it('在第一个 p 标签内渲染“state.inputValue”', () => {
255-
const wrapper = shallowMount(Modules, { store, localVue })
261+
const wrapper = shallowMount(MyComponent, { store, localVue })
256262
const p = wrapper.find('p')
257-
expect(p.text()).toBe(state.module.clicks.toString())
263+
expect(p.text()).toBe(state.clicks.toString())
258264
})
259265
})
260266
```

0 commit comments

Comments
 (0)