blob: 8f29fd2d69c680c6f57c3a913dc4c029c9ab890a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<input id="content" type='text' size='80' value='This is a test. This is the second sentence. And this the third.'/>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests the ability to get element text for different granularities and offsets.");
if (window.accessibilityController) {
document.getElementById("content").focus();
var content = accessibilityController.focusedElement;
shouldBe("content.characterAtOffset(0)", "'T, 0, 1'");
shouldBe("content.wordAtOffset(0)", "'This , 0, 5'");
shouldBe("content.wordAtOffset(4)", "'This , 0, 5'");
shouldBe("content.wordAtOffset(10)", "'test. , 10, 16'");
shouldBe("content.wordAtOffset(58)", "'third., 58, 64'");
shouldBe("content.sentenceAtOffset(0)", "'This is a test. , 0, 16'");
shouldBe("content.sentenceAtOffset(15)", "'This is a test. , 0, 16'");
shouldBe("content.lineAtOffset(0)", "'This is a test. This is the second sentence. And this the third., 0, 64'");
document.getElementById("content").value = "foo bar baz";
shouldBe("content.lineAtOffset(0)", "'foo bar baz, 0, 11'");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>