summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/close-watcher/esc-key/keypress.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/close-watcher/esc-key/keypress.html')
-rw-r--r--testing/web-platform/tests/close-watcher/esc-key/keypress.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/close-watcher/esc-key/keypress.html b/testing/web-platform/tests/close-watcher/esc-key/keypress.html
new file mode 100644
index 0000000000..8dd58b064d
--- /dev/null
+++ b/testing/web-platform/tests/close-watcher/esc-key/keypress.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src="../resources/helpers.js"></script>
+
+<body>
+<script>
+promise_test(async t => {
+ let events = [];
+ let watcher = createRecordingCloseWatcher(t, events);
+
+ window.onkeypress = e => e.preventDefault();
+
+ await sendEscKey();
+
+ assert_array_equals(events, ["close"]);
+}, "A keypress listener can NOT prevent the Esc keypress from being interpreted as a close request");
+</script>