blob: 17e871553a928cc2c9484d4afb16a3bf9475e58f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('Unit tests for WebCore text iterator with shadow tree support enabled');
var subframe = document.createElement('iframe');
document.body.appendChild(subframe);
function appendBrElement(node)
{
node.appendChild(document.createElement('br'));
}
function addShadowTreeWithDivElement(node)
{
node.createShadowRoot();
internals.oldestShadowRoot(node).innerHTML = '<div>b</div>';
}
var testDocument = subframe.contentDocument;
var range = testDocument.createRange();
var head = testDocument.createElement("head");
testDocument.documentElement.insertBefore(head, testDocument.documentElement.firstChild);
testDocument.body.innerHTML = '<div>a</div>';
var div = testDocument.body.childNodes[0];
shouldBe('addShadowTreeWithDivElement(div); range.selectNodeContents(internals.oldestShadowRoot(div)); internals.rangeAsText(range)', '"b"');
shouldBe('appendBrElement(internals.oldestShadowRoot(div).childNodes[0]); range.selectNodeContents(internals.oldestShadowRoot(div)); internals.rangeAsText(range)', '"b\\n"');
document.body.removeChild(subframe);
var successfullyParsed = true;
</script>
</body>
</html>