blob: 204c26a21c8ce5a5ebb02ea4827124408ec13f19 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="host"><b id="one">one</b><b id="two">two</b></div>
<div id="log"></div>
<script>
var host = document.querySelector('#host');
var shadowRoot = host.createShadowRoot();
shadowRoot.innerHTML = 'A<content select=#two></content>B C<content select=#one></content>D';
var two = document.querySelector('#two');
test(function() {
if (!window.eventSender || window.internals)
return;
eventSender.mouseMoveTo(two.offsetLeft + 3, two.offsetTop + 3);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
// TODO(yosin) Once Selection API consider about flat tree, we should
// use Selection.{anchor,focus}{Node,Offset} to check selection boundary
// point.
assert_equals(internals.selectedTextForClipboard(), 'AtwoB');
// TODO(yosin) Once Selection API supports flat tree, we should change
// these values.
var selection = shadowRoot.getSelection();
assert_equals(selection.anchorNode(), 'two');
assert_equals(selection.anchorNode(), 1);
assert_equals(selection.focusNode(), 'two');
assert_equals(selection.focusNode(), 1);
}, 'Double-click in shadow tree');
</script>