I'm trying to test an event handler that reacts to the shift
+ delete
key combo, but the Ember docs for the Test.keyEvent
method don't seem to mention any way to activate modifier keys.
I tried issuing a keydown
on shift
(keyCode 16), then keydown
on delete
(keyCode 46):
keyEvent('.my input', 'keydown', 16); // Shift
keyEvent('.my input', 'keydown', 46); // Delete
keyEvent('.my input', 'keyup', 46); // Delete
keyEvent('.my input', 'keyup', 16); // Shift
but the delete event's shiftKey
property is still undefined
It seems the answer is to use triggerEvent
instead of keyEvent
:
triggerEvent('.my input', 'keydown', {
keyCode: 46, // Delete
shiftKey: true
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With