OLD | NEW |
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="../../../editing/assert_selection.js"></script> | 4 <script src="../../../editing/assert_selection.js"></script> |
5 <script> | 5 <script> |
6 function selectInElement(document, element) { | 6 function selectInElement(document, element) { |
7 eventSender.mouseMoveTo(document.offsetLeft + element.offsetLeft + 2, | 7 eventSender.mouseMoveTo(document.offsetLeft + element.offsetLeft + 2, |
8 document.offsetTop + element.offsetTop + | 8 document.offsetTop + element.offsetTop + |
9 element.offsetHeight / 2); | 9 element.offsetHeight / 2); |
10 eventSender.mouseDown(); | 10 eventSender.mouseDown(); |
(...skipping 18 matching lines...) Expand all Loading... |
29 const document = selection.document; | 29 const document = selection.document; |
30 const host = document.getElementById('host'); | 30 const host = document.getElementById('host'); |
31 const shadowRoot1 = host.createShadowRoot(); | 31 const shadowRoot1 = host.createShadowRoot(); |
32 shadowRoot1.innerHTML = '<div id="target">abc</div>'; | 32 shadowRoot1.innerHTML = '<div id="target">abc</div>'; |
33 const target = shadowRoot1.getElementById('target'); | 33 const target = shadowRoot1.getElementById('target'); |
34 | 34 |
35 selectInElement(document, target); | 35 selectInElement(document, target); |
36 host.remove(); | 36 host.remove(); |
37 }, | 37 }, |
38 [ | 38 [ |
39 '<div>', | 39 '|<div>', |
40 ' |', | 40 ' ', |
41 '</div>', | 41 '</div>', |
42 ].join('\n'), | 42 ].join('\n'), |
43 {dumpAs: 'flattree'}); | 43 {dumpAs: 'flattree'}); |
44 }, 'Remove shadow host containing selection'); | 44 }, 'Remove shadow host containing selection'); |
45 | 45 |
46 test(() => { | 46 test(() => { |
47 assert_not_equals(window.eventSender, undefined, | 47 assert_not_equals(window.eventSender, undefined, |
48 'This test requires eventSender.'); | 48 'This test requires eventSender.'); |
49 | 49 |
50 assert_selection( | 50 assert_selection( |
51 [ | 51 [ |
52 '<div>', | 52 '<div>', |
53 ' <div id="host"></div>', | 53 ' <div id="host"></div>', |
54 '</div>', | 54 '</div>', |
55 ].join('\n'), | 55 ].join('\n'), |
56 selection => { | 56 selection => { |
57 const document = selection.document; | 57 const document = selection.document; |
58 const host = document.getElementById('host'); | 58 const host = document.getElementById('host'); |
59 const shadowRoot1 = host.createShadowRoot(); | 59 const shadowRoot1 = host.createShadowRoot(); |
60 shadowRoot1.innerHTML = '<div id="host2"></div>'; | 60 shadowRoot1.innerHTML = '<div id="host2"></div>'; |
61 const host2 = shadowRoot1.getElementById('host2'); | 61 const host2 = shadowRoot1.getElementById('host2'); |
62 const shadowRoot2 = host2.createShadowRoot(); | 62 const shadowRoot2 = host2.createShadowRoot(); |
63 shadowRoot2.innerHTML = '<div id="target">abc</div>'; | 63 shadowRoot2.innerHTML = '<div id="target">abc</div>'; |
64 const target = shadowRoot2.getElementById('target'); | 64 const target = shadowRoot2.getElementById('target'); |
65 | 65 |
66 selectInElement(document, target); | 66 selectInElement(document, target); |
67 host.remove(); | 67 host.remove(); |
68 }, | 68 }, |
69 [ | 69 [ |
70 '<div>', | 70 '|<div>', |
71 ' |', | 71 ' ', |
72 '</div>', | 72 '</div>', |
73 ].join('\n'), | 73 ].join('\n'), |
74 {dumpAs: 'flattree'}); | 74 {dumpAs: 'flattree'}); |
75 }, 'Remove shadow host containing selection in nested shadow tree'); | 75 }, 'Remove shadow host containing selection in nested shadow tree'); |
76 </script> | 76 </script> |
OLD | NEW |