Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / aria-selected.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 <script src="../resources/accessibility-helper.js"></script>
6 </head>
7 <body id="body">
8 <div id="content">
9   <div role="tablist" id="tablist" tabindex="0">
10     <div role="tab" aria-label="first">1</div>
11     <div role="tab" aria-label="second" aria-selected="true">2</div>
12     <div role="tab" aria-label="third">3</div>
13   </div>
14   <div role="tree" id="tree" aria-multiselectable="true" tabindex="0">
15     <div role="treeitem" aria-label="first" aria-selected="true">1</div>
16     <div role="treeitem" aria-label="second">2</div>
17     <div role="treeitem" aria-label="third" aria-selected="true">3</div>
18   </div>
19   <div role="grid" id="grid" tabindex="0">
20     <div role="row" aria-label="first"><span role="gridcell">1</span></div>
21     <div role="row" aria-label="second" aria-selected="true"><span role="gridcell">2</span></div>
22     <div role="row" aria-label="third"><span role="gridcell">3</span></div>
23   </div>
24   <div tabindex="0" role="treegrid" id="treegrid" aria-activedescendant="row1">
25     <div role="row" aria-level="1" aria-label="first - level 1" aria-expanded="true">
26       <div role="gridcell" tabindex="0">- Expanded</div>
27     </div>
28     <div role="row" aria-label="first - level 2" aria-level="2" aria-selected="true">
29       <div role="gridcell">Data 1</div><div role="gridcell">Data 2</div>
30     </div>
31     <div role="row" aria-label="second - level 2" aria-level="2">
32       <div role="gridcell">Data 3</div><div role="gridcell">Data 4</div>
33     </div>
34     <div role="row" aria-label="third - level 2" aria-level="2" aria-selected="true">
35       <div role="gridcell">Data 4</div><div role="gridcell">Data 5</div>
36     </div>
37     <div role="row" aria-level="1" aria-label="second - level 1" aria-expanded="false">
38       <div role="gridcell" tabindex="0">+ Expand me</div>
39     </div>
40   </div>
41 </div>
42 <p id="description"></p>
43 <div id="console"></div>
44 <script>
45     function selectedChildInfo(axElement) {
46         if (!axElement)
47             debug("Element not exposed");
48
49         var count = axElement.selectedChildrenCount;
50         debug(axElement.role + " has " + count + " selected child(ren)");
51         for (var i = 0; i < count; i++) {
52             var child = axElement.selectedChildAtIndex(i);
53             result = ("\t" + platformValueForW3CName(child) + " (" + child.role + ")")
54             result += " isSelectable: " + child.isSelectable + " isSelected: " + child.isSelected;
55             debug(result);
56         }
57    }
58
59     description("This tests that items with aria-selected are reported as selected children of the parent container.");
60     if (window.accessibilityController) {
61         selectedChildInfo(window.accessibilityController.accessibleElementById("tablist"));
62         selectedChildInfo(window.accessibilityController.accessibleElementById("tree"));
63         selectedChildInfo(window.accessibilityController.accessibleElementById("grid"));
64         selectedChildInfo(window.accessibilityController.accessibleElementById("treegrid"));
65         document.getElementById("content").style.visibility = "hidden";
66     }
67 </script>
68
69 <script src="../resources/js-test-post.js"></script>
70 </body>
71 </html>