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

how to unit test? #118

Open
chr1soscl opened this issue Oct 16, 2019 · 1 comment
Open

how to unit test? #118

chr1soscl opened this issue Oct 16, 2019 · 1 comment

Comments

@chr1soscl
Copy link

How can I unit test this piece of code? I cannot find any example on how I can unit test this:


 this.hotkeysService.add(new Hotkey('ctrl+shift+t', (event: KeyboardEvent): boolean => {
       //my actions
        return false; // Prevent bubbling
      }));
@wittlock
Copy link
Collaborator

Not really familiar with any easy way to do unit tests that emulate keyboard presses. But you could probably create a mock hotkeysService that you inject into your component or service and verify that the hotkeys you expect are registered. I think that's the best option I can think of at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants