cfleizach@apple.com | 9c559e7 | 2009-12-04 07:50:48 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 | <html> |
| 3 | <head> |
mark.lam@apple.com | 44b4166 | 2013-09-08 04:22:45 +0000 | [diff] [blame] | 4 | <script src="../../../resources/js-test-pre.js"></script> |
cfleizach@apple.com | 9c559e7 | 2009-12-04 07:50:48 +0000 | [diff] [blame] | 5 | </head> |
| 6 | <body id="body"> |
| 7 | |
| 8 | <ul id="tree0" role="tree" aria-labelledby="treelabel" aria-multiselectable="true" tabindex="0"> |
| 9 | <li id="tree0_item0" role="treeitem" aria-level="1" aria-selected="true" aria-expanded="true"><span> |
| 10 | <span class="expander"></span>Animals</span> |
| 11 | <ul role="group"> |
| 12 | <li id="tree0_item0_0" aria-selected="true" role="treeitem" aria-level="2"><span>Birds</span></li> |
| 13 | <li id="tree0_item0_1" aria-selected="true" role="treeitem" aria-level="2" aria-expanded="false"> |
| 14 | <span><span class="expander"></span>Cats</span> |
| 15 | <ul role="group"> |
| 16 | <li id="tree0_item0_1_0" aria-selected="true" role="treeitem"aria-level="3"><span>Siamese</span></li> |
| 17 | <li id="tree0_item0_1_1" aria-selected="true" role="treeitem" aria-level="3"><span>Tabby</span></li> |
| 18 | </ul> |
| 19 | </li> |
| 20 | </ul> |
| 21 | </li> |
| 22 | </ul> |
| 23 | |
| 24 | <p id="description"></p> |
| 25 | <div id="console"></div> |
| 26 | |
| 27 | <script> |
| 28 | |
| 29 | description("This tests that the index attribute is correctly returned for all tree items, regardless of their hierarchical level."); |
| 30 | |
| 31 | if (window.accessibilityController) { |
| 32 | |
| 33 | var tree = document.getElementById("tree0"); |
| 34 | tree.focus(); |
| 35 | var axtree = accessibilityController.focusedElement; |
| 36 | |
| 37 | tree.setAttribute("activedescendant", "tree0_item0"); |
| 38 | shouldBe("axtree.selectedRowAtIndex(0).indexInTable()", "0"); |
| 39 | |
| 40 | tree.setAttribute("activedescendant", "tree0_item0_0"); |
| 41 | shouldBe("axtree.selectedRowAtIndex(1).indexInTable()", "1"); |
| 42 | |
| 43 | tree.setAttribute("activedescendant", "tree0_item0_1"); |
| 44 | shouldBe("axtree.selectedRowAtIndex(2).indexInTable()", "2"); |
| 45 | |
| 46 | tree.setAttribute("activedescendant", "tree0_item0_1_0"); |
| 47 | shouldBe("axtree.selectedRowAtIndex(3).indexInTable()", "3"); |
| 48 | |
| 49 | tree.setAttribute("activedescendant", "tree0_item0_1_1"); |
| 50 | shouldBe("axtree.selectedRowAtIndex(4).indexInTable()", "4"); |
| 51 | } |
| 52 | |
cfleizach@apple.com | 9c559e7 | 2009-12-04 07:50:48 +0000 | [diff] [blame] | 53 | </script> |
| 54 | |
mark.lam@apple.com | 44b4166 | 2013-09-08 04:22:45 +0000 | [diff] [blame] | 55 | <script src="../../../resources/js-test-post.js"></script> |
cfleizach@apple.com | 9c559e7 | 2009-12-04 07:50:48 +0000 | [diff] [blame] | 56 | </body> |
| 57 | </html> |