diff --git a/docs/api/wrapper/setChecked.md b/docs/api/wrapper/setChecked.md index 8554bdcc5..38a2e6a9f 100644 --- a/docs/api/wrapper/setChecked.md +++ b/docs/api/wrapper/setChecked.md @@ -1,6 +1,6 @@ ## setChecked(value) -Sets the value of a radio or checkbox `. +Sets the value of a radio or checkbox ``. - **Arguments:** - `{Boolean} selected` diff --git a/docs/zh/README.md b/docs/zh/README.md index 073315c79..7ee677fb0 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -47,9 +47,12 @@ Vue Test Utils 是 Vue.js 官方的单元测试实用工具库。 * [isVueInstance](api/wrapper/isVueInstance.md) * [name](api/wrapper/name.md) * [props](api/wrapper/props.md) + * [setChecked](api/wrapper/setChecked.md) * [setData](api/wrapper/setData.md) * [setMethods](api/wrapper/setMethods.md) * [setProps](api/wrapper/setProps.md) + * [setSelected](api/wrapper/setSelected.md) + * [setValue](api/wrapper/setValue.md) * [text](api/wrapper/text.md) * [trigger](api/wrapper/trigger.md) * [isVisible](api/wrapper/isVisible.md) diff --git a/docs/zh/api/mount.md b/docs/zh/api/mount.md index a09ba0391..3528901e9 100644 --- a/docs/zh/api/mount.md +++ b/docs/zh/api/mount.md @@ -62,7 +62,7 @@ describe('Foo', () => { }) }) ``` -**默认的和具名的插槽:** +**默认插槽和具名插槽:** ```js import { mount } from '@vue/test-utils' diff --git a/docs/zh/api/options.md b/docs/zh/api/options.md index 8732e8f64..2365dcfab 100644 --- a/docs/zh/api/options.md +++ b/docs/zh/api/options.md @@ -63,7 +63,7 @@ expect(wrapper.find('div')).toBe(true) - 类型:`{ [name: string]: string }` -提供一个该组件所有带作用域的插槽内容的对象。每个键对应到插槽的名字,每个值可以是一个模板字符串。 +提供一个该组件所有作用域插槽内容的对象。每个键对应到插槽的名字,每个值可以是一个模板字符串。 这里有三处限制。 diff --git a/docs/zh/api/shallowMount.md b/docs/zh/api/shallowMount.md index 399d14bfd..3ff44bd93 100644 --- a/docs/zh/api/shallowMount.md +++ b/docs/zh/api/shallowMount.md @@ -72,7 +72,7 @@ describe('Foo', () => { }) ``` -**默认的和具名的插槽:** +**默认插槽和具名插槽:** ```js import { shallowMount } from '@vue/test-utils' diff --git a/docs/zh/api/wrapper/README.md b/docs/zh/api/wrapper/README.md index 33ba40780..11fc1578a 100644 --- a/docs/zh/api/wrapper/README.md +++ b/docs/zh/api/wrapper/README.md @@ -42,8 +42,11 @@ Vue Test Utils 是一个基于包裹器的 API。 !!!include(docs/zh/api/wrapper/isVueInstance.md)!!! !!!include(docs/zh/api/wrapper/name.md)!!! !!!include(docs/zh/api/wrapper/props.md)!!! +!!!include(docs/zh/api/wrapper/setChecked.md)!!! !!!include(docs/zh/api/wrapper/setData.md)!!! !!!include(docs/zh/api/wrapper/setMethods.md)!!! !!!include(docs/zh/api/wrapper/setProps.md)!!! +!!!include(docs/zh/api/wrapper/setSelected.md)!!! +!!!include(docs/zh/api/wrapper/setValue.md)!!! !!!include(docs/zh/api/wrapper/text.md)!!! !!!include(docs/zh/api/wrapper/trigger.md)!!! diff --git a/docs/zh/api/wrapper/setChecked.md b/docs/zh/api/wrapper/setChecked.md new file mode 100644 index 000000000..d5eeb3854 --- /dev/null +++ b/docs/zh/api/wrapper/setChecked.md @@ -0,0 +1,17 @@ +## setChecked(value) + +设置一个 `` 单选框或复选框的值。 + +- **参数:** + - `{Boolean} selected` + +- **示例:** + +```js +import { mount } from '@vue/test-utils' +import Foo from './Foo.vue' + +const wrapper = mount(Foo) +const option = wrapper.find('input[type="radio"]') +option.setChecked() +``` diff --git a/docs/zh/api/wrapper/setSelected.md b/docs/zh/api/wrapper/setSelected.md new file mode 100644 index 000000000..a2cc5c9e4 --- /dev/null +++ b/docs/zh/api/wrapper/setSelected.md @@ -0,0 +1,19 @@ +## setSelected(value) + +在一个 `` 文本的值。 + +- **参数:** + - `{String} value` + +- **示例:** + +```js +import { mount } from '@vue/test-utils' +import Foo from './Foo.vue' + +const wrapper = mount(Foo) +const input = wrapper.find('input[type="text"]') +input.setValue('some value') +``` diff --git a/docs/zh/guides/using-with-vuex.md b/docs/zh/guides/using-with-vuex.md index fb891ab71..4413b90b7 100644 --- a/docs/zh/guides/using-with-vuex.md +++ b/docs/zh/guides/using-with-vuex.md @@ -217,7 +217,7 @@ export default{ import { shallowMount, createLocalVue } from '@vue/test-utils' import Vuex from 'vuex' import MyComponent from '../../../src/components/MyComponent' -import mymodule from '../../../src/store/mymodule' +import myModule from '../../../src/store/myModule' const localVue = createLocalVue() @@ -230,9 +230,7 @@ describe('MyComponent.vue', () => { beforeEach(() => { state = { - module: { - clicks: 2 - } + clicks: 2 } actions = { @@ -241,10 +239,10 @@ describe('MyComponent.vue', () => { store = new Vuex.Store({ modules: { - mymodule: { + myModule: { state, actions, - getters: module.getters + getters: myModule.getters } } })