Describe the bug
I'm trying to test v-model in a component that updates its model value in the setup function. I followed the suggestion from the official docs:
https://test-utils.vuejs.org/guide/advanced/v-model.html
However, since the update event callback relies on the wrapper
object being defined, yet, since setup
is run when mounting, the callback doesn't yet have wrapper
initialized when it's run.
P.S. I'm not using the default
parameter of defineModel
in order to avoid the issue described here:
https://vuejs.org/api/sfc-script-setup.html#definemodel
Reproduction
https://stackblitz.com/edit/github-7j6ahrt8?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts
Expected behavior
Such component behaviour can be tested.
Environment
OS: Linux 6.12 cpe:/o:nixos:nixos:25.05 25.05 (Warbler)
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Memory: 1.14 GB / 7.51 GB
Container: Yes
Shell: 5.2.37 - /run/current-system/sw/bin/bash
Additional context
No response