Skip to content

Commit

Permalink
docs: setValue, setChecked, setSelected (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiller1990 authored and eddyerburgh committed Jun 9, 2018
1 parent b4331ff commit 55e52e2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/api/wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ A `Wrapper` is an object that contains a mounted component or vnode and methods
!!!include(docs/api/wrapper/isVueInstance.md)!!!
!!!include(docs/api/wrapper/name.md)!!!
!!!include(docs/api/wrapper/props.md)!!!
!!!include(docs/api/wrapper/setChecked.md)!!!
!!!include(docs/api/wrapper/setData.md)!!!
!!!include(docs/api/wrapper/setMethods.md)!!!
!!!include(docs/api/wrapper/setProps.md)!!!
!!!include(docs/api/wrapper/setSelected.md)!!!
!!!include(docs/api/wrapper/setValue.md)!!!
!!!include(docs/api/wrapper/text.md)!!!
!!!include(docs/api/wrapper/trigger.md)!!!
18 changes: 18 additions & 0 deletions docs/api/wrapper/setChecked.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## setChecked(value)

Sets the value of a radio or checkbox `<input`>.

- **Arguments:**
- `{Boolean} selected`

- **Example:**

```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()
```

19 changes: 19 additions & 0 deletions docs/api/wrapper/setSelected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## setSelected(value)

Sets a specified `<option>` as selected in a `<select>`.

- **Arguments:**
- `{Boolean} selected`

- **Example:**

```js
import { mount } from '@vue/test-utils'
import Foo from './Foo.vue'

const wrapper = shallowMount(Foo)
const options = wrapper.find('select').findAll('option')

options.at(1).setSelected()
expect(wrapper.text()).to.contain('option1')
```
17 changes: 17 additions & 0 deletions docs/api/wrapper/setValue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## setValue(value)

Sets the value of a text `<input>`.

- **Arguments:**
- `{String} value`

- **Example:**

```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')
```

0 comments on commit 55e52e2

Please sign in to comment.