Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/shadow/event-path-with-slot.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/event-path-with-slot.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/event-path-with-slot.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9d061f3ea3ba83ac53ad6824729bba0bcf6b59ef |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/event-path-with-slot.html |
| @@ -0,0 +1,62 @@ |
| +<!DOCTYPE html> |
| +<script src="../../../resources/testharness.js"></script> |
| +<script src="../../../resources/testharnessreport.js"></script> |
| +<script src="resources/shadow-dom.js"></script> |
| +<div id='host'> |
| + <img id="img" src="../../images/resources/test-load.jpg" slot='slot-1'> |
|
kochi
2016/01/20 09:22:07
nit: please use single quote and double quote cons
yuzuchan
2016/01/20 11:07:50
Done.
|
| + <template data-mode='open'> |
| + <slot name='slot-1'></slot> |
| + </template> |
| +</div> |
| + |
| +<div id='host2'> |
| + <img id="img2" src="../../images/resources/lenna.jpg" slot='slot-2'> |
| + <template data-mode='open'> |
| + <div id='host3'> |
| + <div id='slot-2-parent'> |
| + <slot name='slot-2'></slot> |
| + </div> |
| + <template data-mode='v0'> |
| + <content select='#slot-2-parent'></content> |
| + </template> |
| + </div> |
| + </template> |
| +</div> |
| +<script> |
| + |
| +var host = document.getElementById('host'); |
| +convertTemplatesToShadowRootsWithin(host); |
| +removeWhiteSpaceOnlyTextNodes(host); |
| +document.body.offsetLeft; |
| + |
| +var img = document.getElementById('img'); |
|
kochi
2016/01/20 09:22:07
Loading an image will make this test slower.
For e
yuzuchan
2016/01/20 11:07:50
Done.
|
| +var slot = host.shadowRoot.querySelector('slot'); |
| +var shadowRoot = host.shadowRoot; |
| +var expected_array; |
| + |
| +img.onload = function(e) { |
| + expected_array = [img, slot, shadowRoot, host, document.body, document.documentElement, document]; |
|
kochi
2016/01/20 09:22:07
I thought the last element in event.path would be
kochi
2016/01/20 09:39:05
I was told that "load" event is a special case tha
yuzuchan
2016/01/20 11:07:50
Done.
yuzuchan
2016/01/20 11:07:50
Done.
|
| + test(function() { |
| + assert_array_equals(e.path, expected_array); |
| + }, "Triggered in a slotted element, eventPath should go through shadow tree."); |
| +}; |
| + |
| +var img2 = document.getElementById('img2'); |
|
kochi
2016/01/20 09:22:07
Same as above, could you avoid using <img>?
yuzuchan
2016/01/20 11:07:50
Done.
|
| +var host2 = document.getElementById('host2'); |
| +convertTemplatesToShadowRootsWithin(host2); |
| +var srv1 = host2.shadowRoot; |
|
kochi
2016/01/20 09:22:07
nit: as other ids are not abbreviated, could this
yuzuchan
2016/01/20 11:07:50
Done.
|
| +var host3 = srv1.querySelector('#host3'); |
| +convertTemplatesToShadowRootsWithin(host3); |
| +var slotParent = host3.querySelector('div'); |
| +var slot2 = host3.querySelector('slot'); |
| +var srv0 = host3.shadowRoot; |
| +var content = srv0.querySelector('content'); |
| + |
| +img2.onload = function(e) { |
| + expected_array = [img2, slot2, slotParent, content, srv0, host3, srv1, host2, document.body, document.documentElement, document]; |
|
kochi
2016/01/20 09:22:07
Same as above, could you check if the path ends in
yuzuchan
2016/01/20 11:07:50
Done.
|
| + test(function() { |
| + assert_array_equals(e.path, expected_array); |
| + }, "EventPath works fine with v0 insertion points & v1 slots."); |
| +}; |
| + |
|
kochi
2016/01/20 09:22:07
Could you also add a test that original event targ
yuzuchan
2016/01/20 11:07:50
Done.
|
| +</script> |