blob: e34263add9b2aa2d07a0e7956f2a8d8c859b2e58 [file] [log] [blame]
jdiggs@igalia.com01279e92013-12-09 18:40:09 +00001<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<head>
simon.fraser@apple.combff0cf82015-08-04 03:21:43 +00004<script src="../../resources/js-test-pre.js"></script>
jdiggs@igalia.com01279e92013-12-09 18:40:09 +00005</head>
6<body id="body">
7<p id="content">This is a test. This is the second sentence. And this the third.</p>
8<p id="description"></p>
9<div id="console"></div>
10<script>
11 description("This tests the ability to get element text for different granularities and offsets.");
12 if (window.accessibilityController) {
13 document.getElementById("body").focus();
14 var webArea = accessibilityController.focusedElement;
15 var content = webArea.childAtIndex(0);
16
17 shouldBe("content.characterAtOffset(0)", "'T, 0, 1'");
18 shouldBe("content.wordAtOffset(0)", "'This , 0, 5'");
19 shouldBe("content.wordAtOffset(4)", "'This , 0, 5'");
20 shouldBe("content.wordAtOffset(10)", "'test. , 10, 16'");
21 shouldBe("content.wordAtOffset(58)", "'third., 58, 64'");
22 shouldBe("content.sentenceAtOffset(0)", "'This is a test. , 0, 16'");
23 shouldBe("content.sentenceAtOffset(15)", "'This is a test. , 0, 16'");
24 shouldBe("content.lineAtOffset(0)", "'This is a test. This is the second sentence. And this the third., 0, 64'");
25 }
26</script>
simon.fraser@apple.combff0cf82015-08-04 03:21:43 +000027<script src="../../resources/js-test-post.js"></script>
jdiggs@igalia.com01279e92013-12-09 18:40:09 +000028</body>
29</html>