WAI-ARIA: aria-activedescendant doesn't work as intended
[WebKit-https.git] / LayoutTests / platform / mac / accessibility / aria-tree-index-of-items.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
5 <script>
6 var successfullyParsed = false;
7 </script>
8 <script src="../../../fast/js/resources/js-test-pre.js"></script>
9 </head>
10 <body id="body">
11
12 <ul id="tree0" role="tree" aria-labelledby="treelabel" aria-multiselectable="true" tabindex="0">
13     <li id="tree0_item0" role="treeitem" aria-level="1" aria-selected="true" aria-expanded="true"><span>
14     <span class="expander"></span>Animals</span>
15     <ul role="group">
16         <li id="tree0_item0_0" aria-selected="true" role="treeitem" aria-level="2"><span>Birds</span></li>
17         <li id="tree0_item0_1" aria-selected="true" role="treeitem" aria-level="2" aria-expanded="false">
18         <span><span class="expander"></span>Cats</span>
19         <ul role="group">
20             <li id="tree0_item0_1_0" aria-selected="true" role="treeitem"aria-level="3"><span>Siamese</span></li>
21             <li id="tree0_item0_1_1" aria-selected="true" role="treeitem" aria-level="3"><span>Tabby</span></li>
22          </ul>
23          </li>
24       </ul>
25       </li>
26 </ul>
27
28 <p id="description"></p>
29 <div id="console"></div>
30
31 <script>
32
33     description("This tests that the index attribute is correctly returned for all tree items, regardless of their hierarchical level.");
34
35     if (window.accessibilityController) {
36
37           var tree = document.getElementById("tree0");
38           tree.focus();
39           var axtree = accessibilityController.focusedElement;
40  
41           tree.setAttribute("activedescendant", "tree0_item0");
42           shouldBe("axtree.selectedRowAtIndex(0).indexInTable()", "0");
43
44           tree.setAttribute("activedescendant", "tree0_item0_0");
45           shouldBe("axtree.selectedRowAtIndex(1).indexInTable()", "1");
46
47           tree.setAttribute("activedescendant", "tree0_item0_1");
48           shouldBe("axtree.selectedRowAtIndex(2).indexInTable()", "2");
49
50           tree.setAttribute("activedescendant", "tree0_item0_1_0");
51           shouldBe("axtree.selectedRowAtIndex(3).indexInTable()", "3");
52
53           tree.setAttribute("activedescendant", "tree0_item0_1_1");
54           shouldBe("axtree.selectedRowAtIndex(4).indexInTable()", "4");
55     }
56
57     successfullyParsed = true;
58 </script>
59
60 <script src="../../../fast/js/resources/js-test-post.js"></script>
61 </body>
62 </html>