...
Having rendered a component using render()
we can update the props using rerender()
Code Block | ||
---|---|---|
| ||
const view = render(Component, { props: { exampleProp: []} }); await view.rerender({ exampleProp: [1] }); |
...
Remember v-model is just a prop and an event. So to test a v-model change we can do something that would trigger the event and expect()
that the event handler is called, then pass the new prop value in with a rerender
.
Code Block | ||
---|---|---|
| ||
expect(view.emitted('update:propName')).toEqual([[{VALUE}]]); await view.rerender({ propName: {VALUE} }); |
...