need to implement aria tree roles
[WebKit-https.git] / LayoutTests / platform / mac / accessibility / aria-multiselectable.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="tree" role="tree" aria-multiselectable="true" tabindex="0">
13     <li id="treeitem1" role="treeitem"><span>Siamese</span></li>
14     <li id="treeitem2" role="treeitem"><span>Tabby</span></li>
15 </ul>
16
17 <p id="description"></p>
18 <div id="console"></div>
19
20 <script>
21
22     description("This tests that aria trees that are multi selectable will return the right selected rows.");
23
24     if (window.accessibilityController) {
25
26           var tree = document.getElementById("tree");
27           tree.focus();
28
29           // Test tree attributes.
30           tree = accessibilityController.focusedElement;
31
32           var treeitem1 = tree.childAtIndex(0);
33           shouldBe("treeitem1.role", "'AXRole: AXRow'");
34           shouldBe("treeitem1.subrole", "'AXSubrole: AXOutlineRow'");
35           document.getElementById("treeitem1").setAttribute("aria-selected", true);
36
37           var treeitem2 = tree.childAtIndex(1);
38           shouldBe("treeitem2.role", "'AXRole: AXRow'");
39           shouldBe("treeitem2.subrole", "'AXSubrole: AXOutlineRow'");
40           document.getElementById("treeitem2").setAttribute("aria-selected", true);
41
42           // Test that the tree will give us both rows as selected (since its multi-selectable)
43           var selectedRow1 = tree.selectedRowAtIndex(0);
44           var selectedRow2 = tree.selectedRowAtIndex(1);
45
46           shouldBe("selectedRow1.isEqual(treeitem1)", "true");          
47           shouldBe("selectedRow2.isEqual(treeitem2)", "true");
48
49           // Test that if one of the items becomes de-selected, we still get the right selected row.
50           document.getElementById("treeitem1").setAttribute("aria-selected", false);
51           selectedRow1 = tree.selectedRowAtIndex(0);
52           shouldBe("selectedRow1.isEqual(treeitem2)", "true");          
53     }
54
55     successfullyParsed = true;
56 </script>
57
58 <script src="../../../fast/js/resources/js-test-post.js"></script>
59 </body>
60 </html>