e484fb87fc30740a09296aedee786c0f97c5c075
[WebKit-https.git] / LayoutTests / accessibility / aria-menubar-menuitems.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script>
5 var successfullyParsed = false;
6 </script>
7 <script src="../fast/js/resources/js-test-pre.js"></script>
8 </head>
9 <body id="body">
10
11 <ul id="menubar" role="menubar" aria-owns="menuitem1 menuitem2">
12   <li id="menuitem1" role="menuitem" tabindex="0" aria-owns="submenu1">
13     Menu 1
14     <ul id="submenu1" role="menu">
15       <li id="menuitem11" role="menuitemradio" tabindex="-1">
16         Menu item 1.1
17       </li>
18     </ul>
19   </li>
20   <li id="menuitem2" role="menuitem" tabindex="0" aria-owns="submenu2">
21     Menu 2
22     <ul id="submenu2" role="menu">
23       <li id="menuitem21" role="menuitemradio" tabindex="-1">
24         Menu item 2.1
25       </li>
26       <li id="menuitem22" role="menuitemradio" tabindex="-1">
27         Menu item 2.2
28       </li>
29     </ul>
30   </li>
31 </ul>
32
33 <p id="description"></p>
34 <div id="console"></div>
35 <script>
36 description("This tests that ARIA menu items are properly exposed as children for menu bars");
37
38 if (window.layoutController) {
39     layoutTestController.dumpAsText();
40 }
41
42 if (window.accessibilityController) {
43     document.getElementById("body").focus();
44     var webArea = accessibilityController.focusedElement;
45
46     var menuBar = webArea.childAtIndex(0);
47     debug(menuBar.role);
48     shouldBe("menuBar.childrenCount", "2");
49
50     var menuItem = menuBar.childAtIndex(0);
51     debug(menuItem.role);
52     shouldBe("menuItem.childrenCount", "2");
53
54     var menuSubItem1 = menuItem.childAtIndex(0);
55     debug(menuSubItem1.role);
56     shouldBe("menuSubItem1.childrenCount", "0");
57
58     var menuSubItem2 = menuItem.childAtIndex(1);
59     debug(menuSubItem2.role);
60     shouldBe("menuSubItem2.childrenCount", "1");
61
62     var subMenuSubItem = menuSubItem2.childAtIndex(0);
63     debug(subMenuSubItem.role);
64     shouldBe("subMenuSubItem.childrenCount", "0");
65 }
66
67 successfullyParsed = true;
68 </script>
69 <script src="../fast/js/resources/js-test-post.js"></script>
70 </body>
71 </html>