From 0048077161147e11737ec708cff8dcd6aae43e18 Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Fri, 1 May 2020 21:12:01 +0000 Subject: [PATCH] Use `event.key` in tests instead of deprecated event.which --- .../samples/action-custom-event-handler-this/_config.js | 2 +- .../samples/action-custom-event-handler-this/main.svelte | 4 ++-- test/runtime/samples/window-event-custom/_config.js | 2 +- test/runtime/samples/window-event-custom/main.svelte | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/runtime/samples/action-custom-event-handler-this/_config.js b/test/runtime/samples/action-custom-event-handler-this/_config.js index 194fa08c31..88a30232ab 100644 --- a/test/runtime/samples/action-custom-event-handler-this/_config.js +++ b/test/runtime/samples/action-custom-event-handler-this/_config.js @@ -4,7 +4,7 @@ export default { test({ assert, component, target, window }) { const input = target.querySelector('input'); const event = new window.KeyboardEvent('keydown', { - which: 13 + key: 'Enter' }); let blurred = false; diff --git a/test/runtime/samples/action-custom-event-handler-this/main.svelte b/test/runtime/samples/action-custom-event-handler-this/main.svelte index a7347cdc99..c3ace108a5 100644 --- a/test/runtime/samples/action-custom-event-handler-this/main.svelte +++ b/test/runtime/samples/action-custom-event-handler-this/main.svelte @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/test/runtime/samples/window-event-custom/_config.js b/test/runtime/samples/window-event-custom/_config.js index 207fad1b0b..1c1075c0de 100644 --- a/test/runtime/samples/window-event-custom/_config.js +++ b/test/runtime/samples/window-event-custom/_config.js @@ -3,7 +3,7 @@ export default { async test({ assert, component, target, window }) { const event = new window.KeyboardEvent('keydown', { - which: 27 + key: 'Escape' }); await window.dispatchEvent(event); diff --git a/test/runtime/samples/window-event-custom/main.svelte b/test/runtime/samples/window-event-custom/main.svelte index ce453d9334..ff286f4309 100644 --- a/test/runtime/samples/window-event-custom/main.svelte +++ b/test/runtime/samples/window-event-custom/main.svelte @@ -3,7 +3,7 @@ function esc(node, callback) { function onKeyDown(event) { - if (event.which === 27) callback(event); + if (event.key === 'Escape') callback(event); } node.addEventListener('keydown', onKeyDown); return { @@ -16,4 +16,4 @@ -

escaped: {escaped}

\ No newline at end of file +

escaped: {escaped}