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

Support for spectator.keyboard.pressKey w/ modifier keys #241

Closed
dedwardstech opened this issue Dec 3, 2019 · 4 comments
Closed

Support for spectator.keyboard.pressKey w/ modifier keys #241

dedwardstech opened this issue Dec 3, 2019 · 4 comments

Comments

@dedwardstech
Copy link
Contributor

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

spectator.keyboard.pressKey('s') only supports single key presses. There is currently not a way to fake pressing a keyboard key with modifiers like ctrl + shift + s

Expected behavior

I should be able to mock keyboard events like spectator.keyboard.pressKey('ctrl.shift.s')

What is the motivation / use case for changing the behavior?

Providing a more robust experience when mocking keyboard events.

Others:

I have a PR ready to go for adding this feature. If this feature is deemed appropriate. I just have a question around the syntax and what it should be. ctrl.shift.s vs ctrl + shift + s.

@dedwardstech dedwardstech changed the title Support for modifier keys Support for spectator.keyboard.pressKey w/ modifier keys Dec 3, 2019
@benelliott
Copy link
Collaborator

Sounds good to me, I would vote for the + syntax but would wait to hear what @NetanelBasal thinks!

@NetanelBasal
Copy link
Member

NetanelBasal commented Dec 4, 2019

Let's be consistent and use the Angular syntax:

<div (document:keydown.meta.a.g)="doSomething()"></div>
<div (document:keydown.g.c)="doSomething()"></div>
<input (keydown.control.arrowdown)="doSomething()">
<input (keydown.shift.control.z)="doSomething()">

@benelliott
Copy link
Collaborator

I didn't know you could do that! Cool

@dedwardstech
Copy link
Contributor Author

Okay, I'll get the PR up today.

dedwardstech added a commit to dedwardstech/spectator that referenced this issue Dec 5, 2019
This commit adds support to spectator.keyboard.pressKey() for triggering
key events with modifier keys.

Example, spectator.keyboard.pressKey('ctrl.shift.a').
dedwardstech added a commit to dedwardstech/spectator that referenced this issue Dec 5, 2019
This commit adds support to spectator.keyboard.pressKey() for triggering
key events with modifier keys.

Example, spectator.keyboard.pressKey('ctrl.shift.a').
NetanelBasal pushed a commit that referenced this issue Dec 5, 2019
This commit adds support to spectator.keyboard.pressKey() for triggering
key events with modifier keys.

Example, spectator.keyboard.pressKey('ctrl.shift.a').
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants