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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/dom/events/Event-propagation.html

Issue 2273143002: Update web-platform-tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update baseline Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <title>Event propagation tests</title> 2 <title>Event propagation tests</title>
3 <link rel=author title="Aryeh Gregor" href=ayg@aryeh.name> 3 <link rel=author title="Aryeh Gregor" href=ayg@aryeh.name>
4 <div id=log></div> 4 <div id=log></div>
5 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharness.js></script>
6 <script src=/resources/testharnessreport.js></script> 6 <script src=/resources/testharnessreport.js></script>
7 <script> 7 <script>
8 "use strict"; 8 "use strict";
9 9
10 function testPropagationFlag(ev, expected, desc) { 10 function testPropagationFlag(ev, expected, desc) {
11 test(function() { 11 test(function() {
12 var called = false; 12 var called = false;
13 var callback = function() { called = true }; 13 var callback = function() { called = true };
14 document.head.addEventListener("foo", callback); 14 document.head.addEventListener("foo", callback);
15 document.head.dispatchEvent(ev); 15 document.head.dispatchEvent(ev);
16 // Gecko resets the flags after dispatching; it will happily dispatch 16 assert_equals(called, expected, "Propagation flag");
17 // dispatchEvent resets the propagation flags so it will happily dispatch
17 // the event the second time around. 18 // the event the second time around.
18 document.head.dispatchEvent(ev); 19 document.head.dispatchEvent(ev);
19 assert_equals(called, expected, "Propagation flag"); 20 assert_equals(called, true, "Propagation flag after first dispatch");
20 document.head.removeEventListener("foo", callback); 21 document.head.removeEventListener("foo", callback);
21 }, desc); 22 }, desc);
22 } 23 }
23 24
24 var ev = document.createEvent("Event"); 25 var ev = document.createEvent("Event");
25 ev.initEvent("foo", true, false); 26 ev.initEvent("foo", true, false);
26 testPropagationFlag(ev, true, "Newly-created Event"); 27 testPropagationFlag(ev, true, "Newly-created Event");
27 ev.stopPropagation(); 28 ev.stopPropagation();
28 testPropagationFlag(ev, false, "After stopPropagation()"); 29 testPropagationFlag(ev, false, "After stopPropagation()");
29 ev.initEvent("foo", true, false); 30 ev.initEvent("foo", true, false);
30 testPropagationFlag(ev, true, "Reinitialized after stopPropagation()"); 31 testPropagationFlag(ev, true, "Reinitialized after stopPropagation()");
31 32
32 var ev = document.createEvent("Event"); 33 var ev = document.createEvent("Event");
33 ev.initEvent("foo", true, false); 34 ev.initEvent("foo", true, false);
34 ev.stopImmediatePropagation(); 35 ev.stopImmediatePropagation();
35 testPropagationFlag(ev, false, "After stopImmediatePropagation()"); 36 testPropagationFlag(ev, false, "After stopImmediatePropagation()");
36 ev.initEvent("foo", true, false); 37 ev.initEvent("foo", true, false);
37 testPropagationFlag(ev, true, "Reinitialized after stopImmediatePropagation()"); 38 testPropagationFlag(ev, true, "Reinitialized after stopImmediatePropagation()");
38 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698