text コントロールの input 要素の 値をセットします。そして、 v-model
に束縛されているデータを更新します。
-
引数:
{any} value
-
例:
import { mount } from '@vue/test-utils'
import Foo from './Foo.vue'
const wrapper = mount(Foo)
const textInput = wrapper.find('input[type="text"]')
textInput.setValue('some value')
const select = wrapper.find('select')
select.setValue('option value')
// requires <select multiple>
const multiselect = wrapper.find('select')
multiselect.setValue(['value1', 'value3'])
-
注:
textInput.setValue(value)
は以下のコードのエイリアスです。
textInput.element.value = value textInput.trigger('input')
select.setValue(value)
は以下のコードのエイリアスです。
select.element.value = value select.trigger('change')