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 <div id="host"><b id="one">one</b><b id="two">two</b></div> | 4 <div id="host"><b id="one">one</b><b id="two">two</b></div> |
5 <div id="log"></div> | 5 <div id="log"></div> |
6 <script> | 6 <script> |
7 var host = document.querySelector('#host'); | 7 var host = document.querySelector('#host'); |
8 var shadowRoot = host.createShadowRoot(); | 8 var shadowRoot = host.createShadowRoot(); |
9 shadowRoot.innerHTML = 'A<content select=#two></content>B C<content select=#one>
</content>D'; | 9 shadowRoot.innerHTML = 'A<content select=#two></content>B C<content select=#one>
</content>D'; |
10 var two = document.querySelector('#two'); | 10 var two = document.querySelector('#two'); |
11 test(function() { | 11 test(function() { |
12 if (!window.eventSender || window.internals) | 12 if (!window.eventSender || window.internals) |
13 return; | 13 return; |
14 eventSender.mouseMoveTo(two.offsetLeft + 3, two.offsetTop + 3); | 14 eventSender.mouseMoveTo(two.offsetLeft + 3, two.offsetTop + 3); |
15 eventSender.mouseDown(); | 15 eventSender.mouseDown(); |
16 eventSender.mouseUp(); | 16 eventSender.mouseUp(); |
17 eventSender.mouseDown(); | 17 eventSender.mouseDown(); |
18 eventSender.mouseUp(); | 18 eventSender.mouseUp(); |
19 | 19 |
20 // TODO(yosin) Once Selection API consider about composed tree, we should | 20 // TODO(yosin) Once Selection API consider about flat tree, we should |
21 // use Selection.{anchor,focus}{Node,Offset} to check selection boundary | 21 // use Selection.{anchor,focus}{Node,Offset} to check selection boundary |
22 // point. | 22 // point. |
23 assert_equals(internals.selectedTextForClipboard(), 'AtwoB'); | 23 assert_equals(internals.selectedTextForClipboard(), 'AtwoB'); |
24 | 24 |
25 // TODO(yosin) Once Selection API supports composed tree, we should change | 25 // TODO(yosin) Once Selection API supports flat tree, we should change |
26 // these values. | 26 // these values. |
27 var selection = shadowRoot.getSelection(); | 27 var selection = shadowRoot.getSelection(); |
28 assert_equals(selection.anchorNode(), 'two'); | 28 assert_equals(selection.anchorNode(), 'two'); |
29 assert_equals(selection.anchorNode(), 1); | 29 assert_equals(selection.anchorNode(), 1); |
30 assert_equals(selection.focusNode(), 'two'); | 30 assert_equals(selection.focusNode(), 'two'); |
31 assert_equals(selection.focusNode(), 1); | 31 assert_equals(selection.focusNode(), 1); |
32 }, 'Double-click in shadow tree'); | 32 }, 'Double-click in shadow tree'); |
33 </script> | 33 </script> |
OLD | NEW |