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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/event-path-with-slot.html

Issue 1606153002: Implement v1 slot logic in EventPath (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test case in layout test Created 4 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/EventPath.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src='../../../resources/testharness.js'></script>
3 <script src='../../../resources/testharnessreport.js'></script>
4 <script src='resources/shadow-dom.js'></script>
5 <div id='host1'>
6 <input id='input1' slot='slot1'>
7 <template data-mode='open'>
8 <slot name='slot1'></slot>
9 </template>
10 </div>
11
12 <div id='host2'>
13 <input id='input2' slot='slot2'>
14 <template data-mode='open'>
15 <div id='host3'>
16 <div id='slot2-parent'>
17 <slot name='slot2'></slot>
18 </div>
19 <template data-mode='v0'>
20 <content select='#slot2-parent'></content>
21 </template>
22 </div>
23 </template>
24 </div>
25
26 <div id='host4'>
27 <template data-mode='open'>
28 <slot name='slot3'></slot>
29 </template>
30 <div id='input-parent' slot='slot3'>
31 <input id='input3'>
32 </div>
33 </div>
34 <script>
35
36 var host1 = document.getElementById('host1');
kochi 2016/01/21 01:26:33 nit: if an element with ID "host1" (in this file,
yuzuchan 2016/01/21 05:10:22 Done.
37 convertTemplatesToShadowRootsWithin(host1);
38 removeWhiteSpaceOnlyTextNodes(host1);
39 document.body.offsetLeft;
40
41 var input1 = document.getElementById('input1');
42 var slot1 = host1.shadowRoot.querySelector('slot');
43 var shadowRoot = host1.shadowRoot;
44
45 input1.onfocus = function(e) {
46 var expected_array1 = [input1, slot1, shadowRoot, host1, document.body, docume nt.documentElement, document, window];
47 test(function() {
kochi 2016/01/21 01:26:33 If the event doesn't happen accidentally, this tes
kochi 2016/01/21 04:55:47 The "focus" event is synchronous (i.e. when such e
yuzuchan 2016/01/21 05:10:22 Thanks for pointing out the issue. How about addin
kochi 2016/01/21 05:22:58 One setup() can only check one "done();"? So if y
yuzuchan 2016/01/21 07:18:12 Done.
48 assert_array_equals(e.path, expected_array1);
49 }, 'Triggered in a slotted element, eventPath should go through shadow tree.') ;
50 };
51
52 var input2 = document.getElementById('input2');
53 var host2 = document.getElementById('host2');
54 convertTemplatesToShadowRootsWithin(host2);
55 var shadowRootV1 = host2.shadowRoot;
56 var host3 = shadowRootV1.querySelector('#host3');
57 convertTemplatesToShadowRootsWithin(host3);
58 var slotParent = host3.querySelector('div');
59 var slot2 = host3.querySelector('slot');
60 var shadowRootV0 = host3.shadowRoot;
61 var content = shadowRootV0.querySelector('content');
62
63 input2.onfocus = function(e) {
64 var expected_array2 = [input2, slot2, slotParent, content, shadowRootV0, host3 , shadowRootV1, host2, document.body, document.documentElement, document, window ];
65 test(function() {
66 assert_array_equals(e.path, expected_array2);
67 }, 'EventPath works fine with v0 insertion points & v1 slots.');
68 };
69
70 var host4 = document.getElementById('host4');
71 convertTemplatesToShadowRootsWithin(host4);
72 var shadowRoot2 = host4.shadowRoot;
73 var slot3 = shadowRoot2.querySelector('slot');
74 var input3 = document.getElementById('input3')
75 var inputParent = document.getElementById('input-parent');
76
77 input3.onfocus = function(e) {
78 var expected_array3 = [input3, inputParent, slot3, shadowRoot2, host4, documen t.body, document.documentElement, document, window];
79 test(function() {
80 assert_array_equals(e.path, expected_array3);
81 }, 'EventPath works fine when event happens to a descendant of a slotted eleme nt.');
82 };
83
84 var focusEvent = document.createEvent('MouseEvents');
85 focusEvent.initMouseEvent('focus');
86 input1.dispatchEvent(focusEvent);
87 input2.dispatchEvent(focusEvent);
88 input3.dispatchEvent(focusEvent);
89
90 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/EventPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698