Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/EventTarget-dispatchEvent-returnvalue.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/EventTarget-dispatchEvent-returnvalue.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/EventTarget-dispatchEvent-returnvalue.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/EventTarget-dispatchEvent-returnvalue.html
new file mode 100644
index 0000000000000000000000000000000000000000..b8d5eb3a6ef52de21d66f653f986d271b7fcddb0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/events/EventTarget-dispatchEvent-returnvalue.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>EventTarget.dispatchEvent: return value</title>
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-event-dispatch">
+<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-preventdefault">
+<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-defaultprevented">
+<script src="../../../../resources/testharness.js"></script>
+<script src="../../../../resources/testharnessreport.js"></script>
+<div id=log></div>
+<table id="table" border="1" style="display: none">
+ <tbody id="table-body">
+ <tr id="table-row">
+ <td id="table-cell">Shady Grove</td>
+ <td>Aeolian</td>
+ </tr>
+ <tr id="parent">
+ <td id="target">Over the river, Charlie</td>
+ <td>Dorian</td>
+ </tr>
+ </tbody>
+</table>
+<script>
+test(function() {
+ var event_type = "foo";
+ var target = document.getElementById("target");
+ var parent = document.getElementById("parent");
+ var default_prevented;
+
+ parent.addEventListener(event_type, function(e) {}, true);
+ target.addEventListener(event_type, function(e) {
+ evt.preventDefault();
+ default_prevented = evt.defaultPrevented;
+ }, true);
+ target.addEventListener(event_type, function(e) {}, true);
+
+ var evt = document.createEvent("Event");
+ evt.initEvent(event_type, true, true);
+
+ assert_true(parent.dispatchEvent(evt));
+ assert_false(target.dispatchEvent(evt));
+ assert_true(default_prevented);
+}, "Return value of EventTarget.dispatchEvent.");
+</script>

Powered by Google App Engine
This is Rietveld 408576698