CFHxKai
How can I know how much times a method inside the mocked composable was called in a test?
Hi. 😄
I'm trying to learn about tests in Nuxt but is a little hard to find content/courses about it.
I have something like this:
This is called one time, and I think this is right because composable is instantiated one time, but how can I get how much times the method
myMethod
is called.
For example inside the component file I have something like this:
And how can I get how much times method (handleMyBtnClick
) inside de component who is handle this clicks are called?
Thank you so much... 😉11 replies
How to prevent navigation in nested routes?
I have a route like
/[firstId]/[secondId]
. The page [firstId]
has a list of links to navigate and a <NuxtPage />
to load a page with the form from secondId data, but before change between nested secondId's routes I'm checking if the form is dirty and trying to prevent navigation asking to user if he really wants to leave and lost the changes.
But in nested page the onBeforeRouteLeave
don`t work.
There is another way to achieve this?
Thank you 👍6 replies