blob: f6c608dfa1765c15aebe01d2d5eb2dd73a4f0842 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../resources/js-test-pre.js"></script>
<style type="text/css">
.selectionDisabled { -webkit-user-select: none; }
.selectionEnabled { -webkit-user-select: auto; }
</style>
</head>
<body>
<div id="container"></div>
<pre id="console" style="visibility: hidden;"></pre>
<script>
function log(message)
{
document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
}
function testFindString(text, target, disableSelection, expected)
{
var selectionStatus = disableSelection ? "selection disabled:" : "selection enabled:";
log("Searching for '" + target + "' in '" + text + "' with " + selectionStatus);
var container = document.getElementById("container");
container.innerText = text;
document.body.offsetTop;
container.className = disableSelection ? "selectionDisabled" : "selectionEnabled";
shouldBe("testRunner.findString('" + target + "', [])", expected);
container.innerText = "";
log("");
}
if (!window.testRunner)
testFailed('This test requires the testRunner object');
else {
for (i = 0; i < 2; i++) {
var disableSelection = (i == 1);
testFindString("Some sample text that can be searched", "e", disableSelection, "true");
testFindString("Some sample text that can be searched", "o", disableSelection, "true");
testFindString("Some sample text that can be searched", "y", disableSelection, "false");
testFindString("Some sample text that can be searched", "t t", disableSelection, "true");
testFindString("insurmountable mountain", "mount", disableSelection, "true");
testFindString("insurmountable mountain", "Wally", disableSelection, "false");
}
}
document.getElementById("console").style.removeProperty("visibility");
var successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>