blob: 1e0c68234ac1af3258841eee870fb60e9998562a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<textarea id="content" cols='80'>This is a test. This is the second sentence. And this the third.</textarea>
<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>