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

Feature Request: keyup event simulator #6

Open
jfgomez86 opened this issue Jul 6, 2009 · 0 comments
Open

Feature Request: keyup event simulator #6

jfgomez86 opened this issue Jul 6, 2009 · 0 comments

Comments

@jfgomez86
Copy link

I just noticed you simulate a 'keypress' event, which doesn't actually mean a 'keyup' event will be triggered when running the fireunit.key helper.
It would be nice if you could add a 'keyup' event helper.
I'm no javascript ninja, but this worked for me:

  // Extend fireunit to make it simulate a keyUp event
  fireunit.keyup = function ( node ){
    node = this.id( node );

    var doc = node.ownerDocument, event = doc.createEvent("KeyEvents");
    event.initKeyEvent("keyup", true, true, doc.defaultView, false, false, false,
    false, false, false);
    return node.dispatchEvent( event );
  }
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

1 participant