I have a form setup using vue.js and v-select
for a currency dropdown. I'm attempting to create a unit test to make sure the current value of the v-select is set to the computed value price_currency
Here is the vue code for the selector
<v-select
name="price_currency"
:value="price_currency"
@input="value => this.updateValue('price_currency', value)"
:options="currencies"
v-validate="validate.select"
:selectOnTab="true">
</v-select>
the :value
is set to price_currency
which is a computed value. In the unit tests, I can use the find method on the v-select
which will return the element, but because it's a vue component and not an actual <select>
the value
element is not set, which means I can't test for it.
How can I write a unit test for the above v-select
which will confirm that the field is set to the computed value of price_currency
? Additionally, I want to test that when price_currency
is updated so is the value on the v-select, but likely once I see an example of testing the value the rest will fall into place.
This seems like a fairly simple test, but I can't find anywhere in the documentation or online a good example of how this can be done.
For my unit tests, I am using VueTestUtils and Jest.