emberjs/ember.js — pull request #4529 by slindberg (2014-03-14 20:05:01+00:00)
Title: [BUGFIX] Add `which` attribute to event triggered by test helper

[According to jQuery](http://api.jquery.com/event.which/), "It is recommended to watch event.which for keyboard key input." Many libraries (such as [bootstrap](https://github.com/twbs/bootstrap/blob/v3.1.1/js/modal.js#L128)) use `event.which` and not `event.keyCode` in keyboard event handling code. jQuery normally does a good job of normalizing both of these attributes for native keyboard events.

However, when constructing artificial keyboard events with `jQuery.Event`, those properties are not 'normalized' like natively generated events, e.g. specifying only `keyCode` when creating an event means that `which` will be undefined in the event handler (see [this jsbin](http://jsbin.com/siyicuwo/1/)). [It doesn't look like this is going to be fixed in jQuery anytime soon](http://bugs.jquery.com/ticket/9101).

This patch adds the `which` attribute to events created by the `keyEvent` test helper to simulate the event normalization done by jQuery.