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

Side by Side Diff: third_party/WebKit/LayoutTests/shadow-dom/event-composed.html

Issue 2030513002: Remove Event.relatedTargetScoped and update event path calculation for relatedTarget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 6 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 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/shadow-dom.js"></script> 4 <script src="resources/shadow-dom.js"></script>
5 <div id=host label=host> 5 <div id=host label=host>
6 <template label=shadowRoot data-mode=open> 6 <template label=shadowRoot data-mode=open>
7 <div label=target></div> 7 <div label=target></div>
8 </template> 8 </template>
9 </div> 9 </div>
10 <script> 10 <script>
11 function assert_event_path_equals(actual, expected) {
12 assert_equals(actual.length, expected.length);
13 for (let i = 0; i < actual.length; ++i) {
14 assert_equals(actual[i][0], expected[i][0], 'currentTarget at ' + i + ' shou ld be same');
15 assert_equals(actual[i][1], expected[i][1], 'relatedTarget at ' + i + ' shou ld be same');
16 assert_array_equals(actual[i][2], expected[i][2], 'composedPath at ' + i + ' should be same');
17 }
18 }
19
20 test(() => { 11 test(() => {
21 const e = new Event('test'); 12 const e = new Event('test');
22 assert_equals(e.composed, false); 13 assert_equals(e.composed, false);
23 }, 'A new events composed value should be set to false by default.'); 14 }, 'A new events composed value should be set to false by default.');
24 15
25 test(() => { 16 test(() => {
26 const e = new Event('test', { composed: true }); 17 const e = new Event('test', { composed: true });
27 assert_equals(e.composed, true); 18 assert_equals(e.composed, true);
28 }, 'Users should be able to set a composed value.'); 19 }, 'Users should be able to set a composed value.');
29 20
30 test(() => { 21 test(() => {
31 let nodes = createTestTree(host); 22 let nodes = createTestTree(host);
32 let log = dispatchEventWithLog(nodes, nodes.target, new Event('test', {bubbles : true})); 23 let log = dispatchEventWithLog(nodes, nodes.target, new Event('test', {bubbles : true}));
33 let expectedPath = ['target', 'shadowRoot']; 24 let expectedPath = ['target', 'shadowRoot'];
34 assert_event_path_equals(log, 25 assert_event_path_equals(log,
35 [['target', null, expectedPath], 26 [['target', null, expectedPath],
36 ['shadowRoot', null, expectedPath]]); 27 ['shadowRoot', null, expectedPath]]);
37 }, 'An event should be scoped by default'); 28 }, 'An event should be scoped by default');
38 29
39 test(() => { 30 test(() => {
40 let nodes = createTestTree(host); 31 let nodes = createTestTree(host);
41 let log = dispatchEventWithLog(nodes, nodes.target, new Event('test', {bubbles : true, composed: true})); 32 let log = dispatchEventWithLog(nodes, nodes.target, new Event('test', {bubbles : true, composed: true}));
42 let expectedPath = ['target', 'shadowRoot', 'host']; 33 let expectedPath = ['target', 'shadowRoot', 'host'];
43 assert_event_path_equals(log, 34 assert_event_path_equals(log,
44 [['target', null, expectedPath], 35 [['target', null, expectedPath],
45 ['shadowRoot', null, expectedPath], 36 ['shadowRoot', null, expectedPath],
46 ['host', null, expectedPath]]); 37 ['host', null, expectedPath]]);
47 }, 'An event should not be scoped if composed is specified'); 38 }, 'An event should not be scoped if composed is specified');
48 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698