Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Having rendered a component using render() we can update the props using rerender()

Code Block
languagejs
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
languagejs
expect(view.emitted('update:propName')).toEqual([[{VALUE}]]);
await view.rerender({ propName: {VALUE} });

...