Assert key and code in keyup input event spec
This commit is contained in:
parent
424afd3faf
commit
e4b0577cb0
3 changed files with 3 additions and 2 deletions
|
@ -15,6 +15,7 @@ namespace atom {
|
||||||
// pressed.
|
// pressed.
|
||||||
ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted);
|
ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted);
|
||||||
|
|
||||||
|
// Ported from ui/events/blink/blink_event_util.h
|
||||||
int WebEventModifiersToEventFlags(int modifiers);
|
int WebEventModifiersToEventFlags(int modifiers);
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
2
spec/fixtures/pages/onkeyup.html
vendored
2
spec/fixtures/pages/onkeyup.html
vendored
|
@ -2,7 +2,7 @@
|
||||||
<body>
|
<body>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
document.onkeyup = function(e) {
|
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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -776,7 +776,7 @@ describe('<webview> tag', function () {
|
||||||
it('can send keyboard event', function (done) {
|
it('can send keyboard event', function (done) {
|
||||||
webview.addEventListener('ipc-message', function (e) {
|
webview.addEventListener('ipc-message', function (e) {
|
||||||
assert.equal(e.channel, 'keyup')
|
assert.equal(e.channel, 'keyup')
|
||||||
assert.deepEqual(e.args, [67, true, false])
|
assert.deepEqual(e.args, ['C', 'KeyC', 67, true, false])
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
webview.addEventListener('dom-ready', function () {
|
webview.addEventListener('dom-ready', function () {
|
||||||
|
|
Loading…
Reference in a new issue