blob: 2230bdfaea807111f641f3b16094387de8b56c62 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<pre id="console"></pre>
<div id="container"></div>
<script>
function moveTo(element) {
var x = element.offsetLeft + element.offsetWidth / 2;
var y = element.offsetTop + element.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
}
function dragFromTo(elementFrom, elementTo) {
moveTo(elementFrom);
eventSender.mouseDown();
moveTo(elementTo);
eventSender.mouseUp();
}
var container = document.getElementById('container');
var shadowRoot1 = container.webkitCreateShadowRoot();
shadowRoot1.innerHTML =
'<div id="div1" title="div1">You Satoh</div>' +
'<div id="div2" title="div2">Sen Yarizui</div>' +
'<div id="div3" title="div3">Ayame Shaga</div>';
var div1 = shadowRoot1.getElementById('div1');
var div2 = shadowRoot1.getElementById('div2');
var div3 = shadowRoot1.getElementById('div3');
var shadowRoot2 = div2.webkitCreateShadowRoot();
shadowRoot2.innerHTML =
'<div id="div4" title="div4">Hana Oshiroi</div>' +
'<div id="div5" title="div5">Ume Shiraume</div>' +
'<div id="div6" title="div6">Mikoto Uzu</div>';
var div4 = shadowRoot2.getElementById('div4');
var div5 = shadowRoot2.getElementById('div5');
var div6 = shadowRoot2.getElementById('div6');
dragFromTo(div4, div6);
var selection = window.getSelection();
// If anchodeNode and focusNode are not in Shadow tree, document is returned
// by internals.treeScopeRootNode().
shouldBe('internals.treeScopeRootNode(selection.anchorNode)', 'document');
shouldBe('internals.treeScopeRootNode(selection.focusNode)', 'document');
var successfullyParsed = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>