jdiggs@igalia.com | 01279e9 | 2013-12-09 18:40:09 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 | <html> |
| 3 | <head> |
simon.fraser@apple.com | bff0cf8 | 2015-08-04 03:21:43 +0000 | [diff] [blame] | 4 | <script src="../../resources/js-test-pre.js"></script> |
jdiggs@igalia.com | 01279e9 | 2013-12-09 18:40:09 +0000 | [diff] [blame] | 5 | </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.com | bff0cf8 | 2015-08-04 03:21:43 +0000 | [diff] [blame] | 27 | <script src="../../resources/js-test-post.js"></script> |
jdiggs@igalia.com | 01279e9 | 2013-12-09 18:40:09 +0000 | [diff] [blame] | 28 | </body> |
| 29 | </html> |