diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html')
-rw-r--r-- | testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html new file mode 100644 index 000000000..f3848b5ad --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html @@ -0,0 +1,63 @@ +<!DOCTYPE html> +<title>Event handlers processing algorithm</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + <body> + <div id="foo" style="width: 100px; height: 100px; background-color: black"></div> + <script> + async_test(function(t) { + var ev = new Event('mouseover', {cancelable: true}); + document.getElementById("foo").onmouseover = t.step_func(function() { return true }); + document.getElementById("foo").dispatchEvent(ev); + assert_equals(ev.defaultPrevented, true) + t.done(); + }, "mouseover listener returning true cancels event"); + + async_test(function(t) { + var ev = new Event('mouseover', {cancelable: true}); + document.getElementById("foo").onmouseover = t.step_func(function() { return false; }); + document.getElementById("foo").dispatchEvent(ev); + assert_equals(ev.defaultPrevented, false); + t.done(); + }, "mouseover listener returning false doesn't cancel event"); + + async_test(function(t) { + var ev = new Event('beforeunload', {cancelable: true}); + window.onbeforeunload = t.step_func(function() {return null}); + window.dispatchEvent(ev); + assert_equals(ev.defaultPrevented, true); + t.done(); + }, "beforeunload listener returning null cancels event"); + + async_test(function(t) { + var ev = new Event('beforeunload', {cancelable: true}); + window.onbeforeunload = t.step_func(function() {return true}); + window.dispatchEvent(ev); + assert_equals(ev.defaultPrevented, false); + t.done(); + }, "beforeunload listener returning non-null doesn't cancel event"); + + async_test(function(t) { + var ev = new Event("click", {cancelable: true}); + document.getElementById("foo").onclick = t.step_func(function() { return false; }); + document.getElementById("foo").dispatchEvent(ev); + assert_equals(ev.defaultPrevented, true); + t.done(); + }, "click listener returning false cancels event"); + + async_test(function(t) { + var ev = new Event("blur", {cancelable: true}); + document.getElementById("foo").onblur = t.step_func(function() { return false; }); + document.getElementById("foo").dispatchEvent(ev); + assert_equals(ev.defaultPrevented, true); + t.done(); + }, "blur listener returning false cancels event"); + + async_test(function(t) { + var ev = new Event("dblclick", {cancelable: true}); + document.getElementById("foo").ondblclick = t.step_func(function() { return false; }); + document.getElementById("foo").dispatchEvent(ev); + assert_equals(ev.defaultPrevented, true); + t.done(); + }, "dblclick listener returning false cancels event"); +</script> |