Is it possible to use the triggerKeyEvent
test helper to initiate default browser behaviour?
So far I can only get it to initiate Ember actions linked to the key event, for example if I have a keyup action defined on .my-input
.
I've tried with keyup
, keydown
and keypress
.
One example would be trying to tab from one input to the next:
await focus(document.querySelector('.my-input'));
await triggerKeyEvent(document.querySelector('.my-input'), "keyup", 'Tab');
Another would be to check or uncheck a focussed checkbox with the spacebar key:
await focus(document.querySelector('.my-checkbox'));
await triggerKeyEvent(document.querySelector('.my-checkbox'), "keypress", 'Space');
Aucun commentaire:
Enregistrer un commentaire