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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/EventObject.multiple.dispatchEvent.html

Issue 1933203002: Import web-platform-tests@343606cdf8f6c7442d1a0309a9fcdd47d6244eca (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase against web-platform tests to pick up my whitespace fix upstream Created 4 years, 8 months 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/uievents/legacy-domevents-tests/approved/EventObject.multiple.dispatchEvent.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/EventObject.multiple.dispatchEvent.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/EventObject.multiple.dispatchEvent.html
new file mode 100644
index 0000000000000000000000000000000000000000..2ddaf708d02f975430e0b5a17af98394f1f27cbe
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/uievents/legacy-domevents-tests/approved/EventObject.multiple.dispatchEvent.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title> Multiple dispatchEvent() and stopPropagation() </title>
+<script src="../../../../../resources/testharness.js"></script>
+<script src="../../../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id=log></div>
+
+<div id="parent" style="display: none">
+ <input id="target" type="hidden" value=""/>
+</div>
+
+<script>
+ var EVENT = "foo";
+ var TARGET = document.getElementById("target");
+ var PARENT = document.getElementById("parent");
+ var ExpectResult = [TARGET, PARENT, PARENT, document, window];
+ var ActualResult = [];
+
+ var description = "Test Description: " +
+ "An event object may be properly dispatched multiple times while also allowing to prevent the event objects " +
+ "propagation prior to the event dispatch.";
+
+ test(function()
+ {
+ var evt = document.createEvent("Event");
+ evt.initEvent(EVENT, true, true);
+
+ TARGET.addEventListener(EVENT, TestEvent, false);
+ PARENT.addEventListener(EVENT, TestEvent, false);
+ document.addEventListener(EVENT, TestEvent, false);
+ window.addEventListener(EVENT, TestEvent, false);
+
+ TARGET.dispatchEvent(evt);
+ PARENT.dispatchEvent(evt);
+ document.dispatchEvent(evt);
+
+ assert_array_equals(ActualResult, ExpectResult);
+
+ }, description);
+
+ function TestEvent(evt)
+ {
+ ActualResult.push(evt.currentTarget);
+
+ if (PARENT == evt.currentTarget)
+ {
+ evt.stopPropagation();
+ }
+ }
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698