We're developing several widgets, and have a requirement that we must support keyboard navigation (accessibility). We've added keyboard navigation as to the spec, and all is well, but we also want to test that it works using unit tests.
What we have tried is testing it with
- selenium, but selenium does not seem to record arrow keys
- busterJS, using the solution given in thread Simulate left and right arrow key event with javascript. But here we get different exceptions indicating that we are doing something illegal.
- Triggering the event using jQuery trigger(), with the same results as the previous attempt.
I can understand that fireing keyboard events with key codes can be viewed as dangerous by browser manufacturers, and thus prohibited (If thats the core problem here). If this is actually the case, is there some option to set in IE10, Chrome or Firefox to enable the possibility to fire the events?
Any comments are welcomed, I might also be looking in the completely wrong direction here, so if you have some thoughts on how to unit test keyboard navigation in javascript, please feel free to enlighten me :)