When setting the text of input types of 'text', 'textarea' and 'password' the capybara webkit driver does not send any keypress events, which are important for some of the widgets we're using.
This patch sends a keydown, keypress and keyup event for every character added to the input and builds the value progressively so it should act more closely to how a real user interacts with a text box.
Send keypresses to text inputs as though as user has actually interac…
…ted with a form
I'm not sure this is the way a normal browser would behave and if your really intended to simulate a user typing, then triggering a sequence of keypresses might be the right way to go
I've emulated the same behaviour I saw when interacting with a text input using google chrome, though it may be a little off in some regards (keycode?) it sends the events in the same order, at least the ones I created a listener for.
There doesn't appear to be any way of sending keypress events in capybara to emulate this behaviour.
Thanks for the patch. I merged this in. If anybody discovers discrepancies between how this behaves and how a real browser session behaves, feel free to report them. These user interactions are tricky, because there's more than one way to fill in a text input (type, paste, click in, tab in, etc). This series of events seems realistic to me.