Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put some information for testing inside vue utils #55

Open
Natega opened this issue Jul 2, 2021 · 2 comments
Open

Put some information for testing inside vue utils #55

Natega opened this issue Jul 2, 2021 · 2 comments
Assignees
Labels
docs 📜 Documentation issue good first issue 🔰 Good for newcomers researching 🔬 This issue is going to need some research done

Comments

@Natega
Copy link

Natega commented Jul 2, 2021

Can you add some information on how to test a component with debounce directive. Thx

@dhershman1 dhershman1 added docs 📜 Documentation issue good first issue 🔰 Good for newcomers researching 🔬 This issue is going to need some research done labels Jul 7, 2021
@dhershman1 dhershman1 self-assigned this Jul 7, 2021
@dhershman1
Copy link
Owner

Sorry, I've been swamped with work things to really look into this, so I'm still researching the best approach.

@renaud-dev
Copy link

renaud-dev commented Apr 11, 2023

@Natega FYI I just ended up building a mocked directive :

export const vueDebounceMockDirective = {
  created(el: any, binding: { value: (...args: any[]) => void }) {
    const debouncedFn = binding.value;

    el.addEventListener('input', (event: any) => {
      debouncedFn(event.target.value);
    });
  }
};

And I use it in my test like this :

// MountingOptions
options = {
  global: {
    // ...
    directives: {
      debounce: vueDebounceMockDirective
     }
 },

It works well using vue-test-utils setValue.

Good luck everyone !
And thank you @dhershman1 for the great lib !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs 📜 Documentation issue good first issue 🔰 Good for newcomers researching 🔬 This issue is going to need some research done
Projects
None yet
Development

No branches or pull requests

3 participants