blob: e34263add9b2aa2d07a0e7956f2a8d8c859b2e58 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<p id="content">This is a test. This is the second sentence. And this the third.</p>
<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("body").focus();
var webArea = accessibilityController.focusedElement;
var content = webArea.childAtIndex(0);
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'");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>