Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / aria-selected-menu-items.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 id="menu1" role="menu" aria-label="First menu">
10       <div role="menuitem" id="item1" aria-label="item 1" tabindex="-1">Menu item 1</div>
11       <div role="menuitem" id="item2" aria-label="item 2" tabindex="0">Menu item 2</div>
12       <div role="menuitem" id="item3" aria-label="item 3" tabindex="-1">Menu item 3</div>
13     </div>
14     <div id="menu2" role="menu" aria-label="Second menu" aria-activedescendant="item5">
15       <div role="menuitemcheckbox" id="item4" aria-label="item 4" tabindex="-1">Menu item 4</div>
16       <div role="menuitemcheckbox" id="item5" aria-label="item 5" tabindex="-1">Menu item 5</div>
17       <div role="menuitemcheckbox" id="item6" aria-label="item 6" tabindex="-1">Menu item 6</div>
18     </div>
19     <div id="menubar1" role="menubar" aria-label="First menubar">
20       <div role="menuitem" id="item7" aria-label="File" tabindex="-1">File</div>
21       <div role="menuitem" id="item8" aria-label="Edit" tabindex="0">Edit</div>
22       <div role="menuitem" id="item9" aria-label="View" tabindex="-1">View</div>
23     </div>
24     <div id="menubar2" role="menubar" aria-label="Second menubar" aria-activedescendant="item12">
25       <div role="menuitem" id="item10" aria-label="File" tabindex="-1">File</div>
26       <div role="menuitem" id="item11" aria-label="Edit" tabindex="-1">Edit</div>
27       <div role="menuitem" id="item12" aria-label="View" tabindex="-1">View</div>
28     </div>
29   </div>
30 <p id="description"></p>
31 <div id="console"></div>
32 <script>
33     function selectedChildInfo(axElement) {
34         if (!axElement)
35             debug("Element not exposed");
36
37         var count = axElement.selectedChildrenCount;
38         debug(platformValueForW3CName(axElement) + " has " + count + " selected child(ren)");
39         for (var i = 0; i < count; i++) {
40             var child = axElement.selectedChildAtIndex(i);
41             result = "\t" + platformValueForW3CName(child) + " (" + child.role + ")";
42             result += " isSelectable: " + child.isSelectable + " isSelected: " + child.isSelected;
43             debug(result);
44         }
45    }
46
47     description("This tests that focused/active menu items are reported as selected children of the parent container.");
48
49     if (window.accessibilityController) {
50         document.getElementById("item2").focus();
51         selectedChildInfo(window.accessibilityController.accessibleElementById("menu1"));
52         selectedChildInfo(window.accessibilityController.accessibleElementById("menu2"));
53         document.getElementById("item8").focus();
54         selectedChildInfo(window.accessibilityController.accessibleElementById("menubar1"));
55         selectedChildInfo(window.accessibilityController.accessibleElementById("menubar2"));
56         document.getElementById("content").style.visibility = "hidden";
57     }
58
59 </script>
60
61 <script src="../resources/js-test-post.js"></script>
62 </body>
63 </html>