https://cypress.io logo
How to mount a component with v-model ?
# i-need-help
b
Hello, I'm trying to test a custom Vue component which is an enhanced
input
element. I can't find the way to mount it with
v-model
(or modelValue + @update). I've tried this unsuccessfully :
Copy code
cy.mount(MyField, {
      props: {
        modelValue: email,
        onUpdate: (val: string) => (email = val),
        'onUpdate:modelValue': (val: string) => (email = val),
        'onUpdate:model-value': (val: string) => (email = val),
      },
    })
Thanks !
'onUpdate:modelValue'
is trigerred,
email
is updated in the test, but the value is not updated in the component.
and if email is a ref (
const email = ref<string>('')
), it's not unwrapped in the component, i see
[object Object]
2 Views