Using Vue, I have some radio inputs:
<label>
<input
v-model="myProperty"
v-bind:value="true"
name="myProperty"
type="radio"
> True
</label>
<label>
<input
v-model="myProperty"
v-validate="input.rules ? input.rules : ''"
v-bind:value="false"
name="myProperty"
type="radio"
> False
</label>
I'm testing them with vue-test-utils
and jest
, where I select and assign a value to my field:
let myProperty = wrapper.find('[name="myProperty"]')
myProperty.setChecked(false)
But I get this error:
[vue-test-utils]: wrapper.setChecked() must be passed a boolean
It works, however, when I set the value as true
instead of false
. As an experiment, I tried setting the value as the string 'false'
:
myProperty.setChecked('false')
Then I got this errror:
[vue-test-utils]: wrapper.setChecked() must be passed a boolean
So how am I supposed to select the radio input I want in vue-test-utils
when the value is false
? And what if my radio inputs have strings for values?
Aucun commentaire:
Enregistrer un commentaire