test_aria_menu.html (2257B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Test accessible tree when ARIA role menuitem is used</title> 5 <link rel="stylesheet" type="text/css" 6 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 7 8 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 9 10 <script type="application/javascript" 11 src="../common.js"></script> 12 <script type="application/javascript" 13 src="../role.js"></script> 14 15 <script type="application/javascript"> 16 function doTest() { 17 // Menuitem with no popup. 18 let tree = 19 { SECTION: [ // container 20 { MENUPOPUP: [ // menu 21 { MENUITEM: [ 22 { LISTITEM_MARKER: [] }, // bullet 23 { TEXT_LEAF: [] }, 24 ] }, 25 ] }, 26 ] }; 27 testAccessibleTree("menu", tree); 28 29 // Menuitem with explicit no popup. 30 tree = 31 { SECTION: [ // container 32 { MENUPOPUP: [ // menu 33 { MENUITEM: [ 34 { LISTITEM_MARKER: [] }, // bullet 35 { TEXT_LEAF: [] }, 36 ] }, 37 ] }, 38 ] }; 39 testAccessibleTree("menu_nopopup", tree); 40 41 // Menuitem with popup. 42 tree = 43 { SECTION: [ // container 44 { MENUPOPUP: [ // menu 45 { PARENT_MENUITEM: [ // menuitem with aria-haspopup="true" 46 { LISTITEM_MARKER: [] }, // bullet 47 { TEXT_LEAF: [] }, 48 ] }, 49 ] }, 50 ] }; 51 testAccessibleTree("menu_popup", tree); 52 53 SimpleTest.finish(); 54 } 55 56 SimpleTest.waitForExplicitFinish(); 57 addA11yLoadEvent(doTest); 58 </script> 59 </head> 60 <body> 61 62 <a target="_blank" 63 href="https://bugzilla.mozilla.org/show_bug.cgi?id=786566" 64 title="ARIA menuitem acting as submenu should have PARENT_MENUITEM role"> 65 Mozilla Bug 786566 66 </a> 67 <p id="display"></p> 68 <div id="content" style="display: none"></div> 69 <pre id="test"> 70 </pre> 71 72 <div id="menu"> 73 <ul role="menu"> 74 <li role="menuitem">Normal Menu</li> 75 </ul> 76 </div> 77 78 <div id="menu_nopopup"> 79 <ul role="menu"> 80 <li role="menuitem" aria-haspopup="false">Menu with explicit no popup</li> 81 </ul> 82 </div> 83 84 <div id="menu_popup"> 85 <ul role="menu"> 86 <li role="menuitem" aria-haspopup="true">Menu with popup</li> 87 </ul> 88 </div> 89 90 </body> 91 </html>