-
foo.vue
test.jsx
|
Beta Was this translation helpful? Give feedback.
Answered by
cexbrayat
Oct 26, 2023
Replies: 1 comment 2 replies
-
Hi @xxholly32 You have to spy on the function before clicking on the button with If that does not work, can you provide us a small repro online using https://stackblitz.com/github/vuejs/create-vue-templates/tree/main/typescript-vitest?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts ? It only takes a few minutes, and we'll be able to take a look |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
cexbrayat
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @xxholly32
You have to spy on the function before clicking on the button with
vi.spyOn(wrapper.vm, 'handleClick')
Also you probably need to have parenthesis on your function call in your template
@click="handleClick()"
If that does not work, can you provide us a small repro online using https://stackblitz.com/github/vuejs/create-vue-templates/tree/main/typescript-vitest?file=src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts ?
It only takes a few minutes, and we'll be able to take a look