jeudi 16 juin 2016

How to simulate a key event with modifier key pressed in an Ember.js integration test?

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('li:nth-last-child(2) input', 'keydown', 16);  // Shift
keyEvent('li:nth-last-child(2) input', 'keydown', 46);  // Delete
keyEvent('li:nth-last-child(2) input', 'keyup', 46);  // Delete
keyEvent('li:nth-last-child(2) input', 'keyup', 16);  // Shift

but the delete event's shiftKey property is still undefined




Aucun commentaire:

Enregistrer un commentaire