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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/shadow-dom/event-composed-path-with-related-target.html

Issue 2408083002: Revert of Import wpt@357b83b809e3cbc7a1805e7c3ca108a7980d782f (Closed)
Patch Set: Created 4 years, 2 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>Shadow DOM: Event path and Event.composedPath() (with related target)</ti tle> 2 <title>Shadow DOM: Event path and Event.composedPath() (with related target)</ti tle>
3 <meta name="author" title="Hayato Ito" href="mailto:hayato@google.com"> 3 <meta name="author" title="Hayato Ito" href="mailto:hayato@google.com">
4 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script> 5 <script src="/resources/testharnessreport.js"></script>
6 <script src="resources/shadow-dom.js"></script> 6 <script src="resources/shadow-dom.js"></script>
7 7
8 <div id="test1"> 8 <div id="test1">
9 <div id="target"></div> 9 <div id="target"></div>
10 <div id="related"></div> 10 <div id="related"></div>
11 </div> 11 </div>
12 12
13 <script> 13 <script>
14 test(() => { 14 test(() => {
15 let n = createTestTree(test1); 15 let n = createTestTree(test1);
16 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.related })); 16 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.related }));
17 let path = ['target', 'test1']; 17 let path = ['target', 'test1'];
18 assert_event_path_equals(log, [['target', 'target', 'related', path], 18 assert_event_path_equals(log, [['target', 'target', 'related', path],
19 ['test1', 'target', 'related', path]]); 19 ['test1', 'target', 'related', path]]);
20 }, 'Event path for an event with a relatedTarget. relatedTarget != target.'); 20 }, 'Event path for an event with a relatedTarget. relatedTarget != target.');
21 </script> 21 </script>
22 22
23 <script> 23 <script>
24 test(() => { 24 test(() => {
25 let n = createTestTree(test1); 25 let n = createTestTree(test1);
26 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.target })); 26 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.target }));
27 let path = ['target', 'test1']; 27 let path = ['target', 'test1'];
28 assert_event_path_equals(log, [['target', 'target', 'target', path], 28 assert_event_path_equals(log, [['target', 'target', 'target', path],
29 ['test1', 'target', 'target', path]]); 29 ['test1', 'target', 'target', path]]);
30 }, 'Event path for an event with a relatedTarget. Event should be dispatched eve n when target and relatedTarget are same.'); 30 }, 'Event path for an event with a relatedTarget. Event shoul be dispatched if 1 ) target and relatedTarget are same, and 2) they are not in a shadow tree.');
31 </script> 31 </script>
32 32
33 <div id="test2"> 33 <div id="test2">
34 <div id="host"> 34 <div id="host">
35 <template id="sr" data-mode="open"> 35 <template id="sr" data-mode="open">
36 <div id="target"></div> 36 <div id="target"></div>
37 <div id="related"></div> 37 <div id="related"></div>
38 </template> 38 </template>
39 </div> 39 </div>
40 </div> 40 </div>
41 41
42 <script> 42 <script>
43 test(() => { 43 test(() => {
44 let n = createTestTree(test2); 44 let n = createTestTree(test2);
45 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.related })); 45 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.related }));
46 let path = ['target', 'sr']; 46 let path = ['target', 'sr'];
47 assert_event_path_equals(log, [['target', 'target', 'related', path], 47 assert_event_path_equals(log, [['target', 'target', 'related', path],
48 ['sr', 'target', 'related', path]]); 48 ['sr', 'target', 'related', path]]);
49 }, 'Event path for an event with a relatedTarget. Event should stop at the shado w root'); 49 }, 'Event path for an event with a relatedTarget. Event should stop at the shado w root');
50 50
51 test(() => { 51 test(() => {
52 let n = createTestTree(test2); 52 let n = createTestTree(test2);
53 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.target })); 53 let log = dispatchEventWithLog(n, n.target, new FocusEvent('my-focus', { bubbl es: true, composed: true, relatedTarget: n.target }));
54 let path = ['target', 'sr']; 54 assert_event_path_equals(log, []);
55 assert_event_path_equals(log, [['target', 'target', 'target', path], 55 }, 'Event path for an event with a relatedTarget. Event should not be dispatched if 1) target and relatedTarget are same, and 2) both are in a shadow tree.');
56 ['sr', 'target', 'target', path]]);
57 }, 'Event path for an event with a relatedTarget which is identical to target. E vent should be dispatched and should stop at the shadow root.');
58 </script> 56 </script>
59 57
60 <div id="test3_1"> 58 <div id="test3_1">
61 <div id="host1"> 59 <div id="host1">
62 <template id="sr1" data-mode="open"> 60 <template id="sr1" data-mode="open">
63 <div id="target1"></div> 61 <div id="target1"></div>
64 </template> 62 </template>
65 </div> 63 </div>
66 </div> 64 </div>
67 65
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 let path = ['target', 'sr2', 'host2', 'sr1']; 127 let path = ['target', 'sr2', 'host2', 'sr1'];
130 assert_event_path_equals(log, [['target', 'target', 'host1', path], 128 assert_event_path_equals(log, [['target', 'target', 'host1', path],
131 ['sr2', 'target', 'host1', path], 129 ['sr2', 'target', 'host1', path],
132 ['host2', 'host2', 'host1', path], 130 ['host2', 'host2', 'host1', path],
133 ['sr1', 'host2', 'host1', path]]); 131 ['sr1', 'host2', 'host1', path]]);
134 }, 'Event path for an event with a relatedTarget. relaterTarget is a shadow-incl uding ancestor of target.'); 132 }, 'Event path for an event with a relatedTarget. relaterTarget is a shadow-incl uding ancestor of target.');
135 133
136 test(() => { 134 test(() => {
137 let n = createTestTree(test4); 135 let n = createTestTree(test4);
138 let log = dispatchEventWithLog(n, n.host1, new FocusEvent('my-focus', { bubble s: true, composed: true, relatedTarget: n.target })); 136 let log = dispatchEventWithLog(n, n.host1, new FocusEvent('my-focus', { bubble s: true, composed: true, relatedTarget: n.target }));
139 let path = ['host1', 'test4']; 137 assert_event_path_equals(log, []);
140 assert_event_path_equals(log, [['host1', 'host1', 'host1', path],
141 ['test4', 'host1', 'host1', path]]);
142 }, 'Event path for an event with a relatedTarget. target is a shadow-including a ncestor of relatedTarget.'); 138 }, 'Event path for an event with a relatedTarget. target is a shadow-including a ncestor of relatedTarget.');
143 </script> 139 </script>
144 140
145 <div id="test5"> 141 <div id="test5">
146 <div id="host"> 142 <div id="host">
147 <template id="sr" data-mode="open"> 143 <template id="sr" data-mode="open">
148 <slot id="slot"></slot> 144 <slot id="slot"></slot>
149 <div id="related"></div> 145 <div id="related"></div>
150 </template> 146 </template>
151 <div id="target"></div> 147 <div id="target"></div>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 ['slot1', 'host3', 'host2', path], 247 ['slot1', 'host3', 'host2', path],
252 ['d1' , 'host3', 'host2', path], 248 ['d1' , 'host3', 'host2', path],
253 ['slot2', 'host3', 'related2', path], 249 ['slot2', 'host3', 'related2', path],
254 ['sr2', 'host3', 'related2', path], 250 ['sr2', 'host3', 'related2', path],
255 ['host2', 'host3', 'host2', path], 251 ['host2', 'host3', 'host2', path],
256 ['sr1', 'host3', 'host2', path], 252 ['sr1', 'host3', 'host2', path],
257 ['host1', 'host3', 'host1', path], 253 ['host1', 'host3', 'host1', path],
258 ['sr0', 'host3', 'host1' , path]]); 254 ['sr0', 'host3', 'host1' , path]]);
259 }, 'Event path for an event with a relatedTarget. Event should be dispatched at every slots. relatedTarget should be correctly retargeted.'); 255 }, 'Event path for an event with a relatedTarget. Event should be dispatched at every slots. relatedTarget should be correctly retargeted.');
260 </script> 256 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698