| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <script src="../../resources/js-test-pre.js"></script> |
| <body id="body" tabindex="0"> |
| <div tabindex="0" id="text"> |
| This is some testing content. |
| </div> |
| |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script> |
| |
| description("This tests that we are able to get a range with desired text that is close to a given range."); |
| |
| if (window.accessibilityController) { |
| accessibilityController.enableEnhancedAccessibility(true); |
| var webArea = accessibilityController.rootElement.childAtIndex(0); |
| var text = accessibilityController.accessibleElementById("text").childAtIndex(0); |
| |
| // Get the marker range (9, 5), should be "ome t". |
| var startMarker = text.startTextMarkerForTextMarkerRange(text.textMarkerRangeForElement(text)); |
| for (var i = 0; i < 9 ; i++) |
| startMarker = text.nextTextMarker(startMarker); |
| var endMarker = startMarker; |
| for (var i = 0; i < 5 ; i++) |
| endMarker = text.nextTextMarker(endMarker); |
| |
| var markerRange = text.textMarkerRangeForMarkers(startMarker, endMarker); |
| shouldBe("text.stringForTextMarkerRange(markerRange)", "'ome t'"); |
| |
| // Search forward and backwards. |
| var matchedMarkerRange = text.textMarkerRangeMatchesTextNearMarkers("testing", startMarker, endMarker); |
| shouldBe("text.stringForTextMarkerRange(matchedMarkerRange)", "'testing'"); |
| |
| matchedMarkerRange = text.textMarkerRangeMatchesTextNearMarkers("some", startMarker, endMarker); |
| shouldBe("text.stringForTextMarkerRange(matchedMarkerRange)", "'some'"); |
| } |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| |
| </body> |
| </html> |
| |