Assert key and code in keyup input event spec

This commit is contained in:
Kevin Sawicki 2016-10-07 14:57:31 -07:00
parent 424afd3faf
commit e4b0577cb0
3 changed files with 3 additions and 2 deletions

View file

@ -15,6 +15,7 @@ namespace atom {
// pressed.
ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted);
// Ported from ui/events/blink/blink_event_util.h
int WebEventModifiersToEventFlags(int modifiers);
} // namespace atom

View file

@ -2,7 +2,7 @@
<body>
<script type="text/javascript" charset="utf-8">
document.onkeyup = function(e) {
require('electron').ipcRenderer.sendToHost('keyup', e.keyCode, e.shiftKey, e.ctrlKey);
require('electron').ipcRenderer.sendToHost('keyup', e.key, e.code, e.keyCode, e.shiftKey, e.ctrlKey);
}
</script>
</body>

View file

@ -776,7 +776,7 @@ describe('<webview> tag', function () {
it('can send keyboard event', function (done) {
webview.addEventListener('ipc-message', function (e) {
assert.equal(e.channel, 'keyup')
assert.deepEqual(e.args, [67, true, false])
assert.deepEqual(e.args, ['C', 'KeyC', 67, true, false])
done()
})
webview.addEventListener('dom-ready', function () {