blob: 5fa751b34d0ca018bfa5c441c942ac254d8039e8 [file] [log] [blame]
simon.fraser@apple.comf75227e2015-08-04 03:00:09 +00001<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2<html>
3<script src="../../resources/js-test-pre.js"></script>
4<body id="body" tabindex="0">
5
6<div tabindex="0" id="item0">item0</div>
7<div tabindex="0" id="item1"><mark>item 1</mark></div>
8<div tabindex="0" id="item2">item2</div>
9
10
11<p id="description"></p>
12<div id="console"></div>
13
14<script>
15
16 description("This verifies that using the mark tag will add the appropriate attribute to the attributed string and that we can find elements with highlighting using searching.");
17
18 if (window.accessibilityController) {
19 document.getElementById("item1").focus();
20 var item1 = accessibilityController.focusedElement;
21 var markerRange = item1.textMarkerRangeForElement(item1);
22 shouldBeTrue("item1.attributedStringForTextMarkerRangeContainsAttribute('AXHighlight', markerRange)");
23
24 document.getElementById("item2").focus();
25 var item2 = accessibilityController.focusedElement;
26 markerRange = item2.textMarkerRangeForElement(item2);
27 shouldBeFalse("item2.attributedStringForTextMarkerRangeContainsAttribute('AXHighlight', markerRange)");
28
29 // Search for a highlighted element from the top of the webpage.
30 document.getElementById("body").focus();
31 var body = accessibilityController.focusedElement;
32 var resultElement = body.uiElementForSearchPredicate("", true, "AXHighlightedSearchKey", "", false);
33 shouldBeTrue("resultElement.isEqual(item1.childAtIndex(0))");
34 }
35
36</script>
37
38<script src="../../resources/js-test-post.js"></script>
39
40</body>
41</html>
42