File tree 4 files changed +57
-0
lines changed
4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,11 @@ A `Wrapper` is an object that contains a mounted component or vnode and methods
42
42
!!!include(docs/api/wrapper/isVueInstance.md)!!!
43
43
!!!include(docs/api/wrapper/name.md)!!!
44
44
!!!include(docs/api/wrapper/props.md)!!!
45
+ !!!include(docs/api/wrapper/setChecked.md)!!!
45
46
!!!include(docs/api/wrapper/setData.md)!!!
46
47
!!!include(docs/api/wrapper/setMethods.md)!!!
47
48
!!!include(docs/api/wrapper/setProps.md)!!!
49
+ !!!include(docs/api/wrapper/setSelected.md)!!!
50
+ !!!include(docs/api/wrapper/setValue.md)!!!
48
51
!!!include(docs/api/wrapper/text.md)!!!
49
52
!!!include(docs/api/wrapper/trigger.md)!!!
Original file line number Diff line number Diff line change
1
+ ## setChecked(value)
2
+
3
+ Sets the value of a radio or checkbox ` <input ` >.
4
+
5
+ - ** Arguments:**
6
+ - ` {Boolean} selected `
7
+
8
+ - ** Example:**
9
+
10
+ ``` js
11
+ import { mount } from ' @vue/test-utils'
12
+ import Foo from ' ./Foo.vue'
13
+
14
+ const wrapper = mount (Foo)
15
+ const option = wrapper .find (' input[type="radio"]' )
16
+ option .setChecked ()
17
+ ```
18
+
Original file line number Diff line number Diff line change
1
+ ## setSelected(value)
2
+
3
+ Sets a specified ` <option> ` as selected in a ` <select> ` .
4
+
5
+ - ** Arguments:**
6
+ - ` {Boolean} selected `
7
+
8
+ - ** Example:**
9
+
10
+ ``` js
11
+ import { mount } from ' @vue/test-utils'
12
+ import Foo from ' ./Foo.vue'
13
+
14
+ const wrapper = shallowMount (Foo)
15
+ const options = wrapper .find (' select' ).findAll (' option' )
16
+
17
+ options .at (1 ).setSelected ()
18
+ expect (wrapper .text ()).to .contain (' option1' )
19
+ ```
Original file line number Diff line number Diff line change
1
+ ## setValue(value)
2
+
3
+ Sets the value of a text ` <input> ` .
4
+
5
+ - ** Arguments:**
6
+ - ` {String} value `
7
+
8
+ - ** Example:**
9
+
10
+ ``` js
11
+ import { mount } from ' @vue/test-utils'
12
+ import Foo from ' ./Foo.vue'
13
+
14
+ const wrapper = mount (Foo)
15
+ const input = wrapper .find (' input[type="text"]' )
16
+ input .setValue (' some value' )
17
+ ```
You can’t perform that action at this time.
0 commit comments