test_menu.xhtml (3229B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 4 type="text/css"?> 5 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 7 title="Accessible XUL menu hierarchy tests"> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 10 11 <script type="application/javascript" 12 src="../common.js" /> 13 <script type="application/javascript" 14 src="../role.js" /> 15 <script type="application/javascript" 16 src="../events.js" /> 17 18 <script type="application/javascript"> 19 <![CDATA[ 20 //////////////////////////////////////////////////////////////////////////// 21 // Invokers 22 23 function openMenu(aID) 24 { 25 this.menuNode = getNode(aID); 26 27 this.eventSeq = [ 28 new invokerChecker(EVENT_FOCUS, this.menuNode) 29 ]; 30 31 this.invoke = function openMenu_invoke() 32 { 33 var tree; 34 if (LINUX || SOLARIS) { 35 tree = 36 { PARENT_MENUITEM: [ ] }; 37 38 } else { 39 tree = 40 { PARENT_MENUITEM: [ 41 { MENUPOPUP: [ ] } 42 ] }; 43 } 44 testAccessibleTree(aID, tree); 45 46 // Show menu. 47 this.menuNode.open = true; 48 } 49 50 this.finalCheck = function openMenu_finalCheck() 51 { 52 var tree; 53 if (LINUX || SOLARIS) { 54 tree = 55 { PARENT_MENUITEM: [ 56 { MENUITEM: [ ] }, 57 { MENUITEM: [ ] } 58 ] }; 59 60 } else { 61 tree = 62 { PARENT_MENUITEM: [ 63 { MENUPOPUP: [ 64 { MENUITEM: [ ] }, 65 { MENUITEM: [ ] } 66 ] } 67 ] }; 68 } 69 testAccessibleTree(aID, tree); 70 } 71 72 this.getID = function openMenu_getID() 73 { 74 return "open menu " + prettyName(aID); 75 } 76 } 77 78 //////////////////////////////////////////////////////////////////////////// 79 // Test 80 81 var gQueue = null; 82 function doTest() 83 { 84 gQueue = new eventQueue(); 85 gQueue.push(new openMenu("menu")); 86 gQueue.invoke(); // Will call SimpleTest.finish(); 87 } 88 89 SimpleTest.waitForExplicitFinish(); 90 addA11yLoadEvent(doTest); 91 ]]> 92 </script> 93 94 <hbox flex="1" style="overflow: auto;"> 95 <body xmlns="http://www.w3.org/1999/xhtml"> 96 <a target="_blank" 97 href="https://bugzilla.mozilla.org/show_bug.cgi?id=249292" 98 title="Ensure accessible children for toolbarbutton types 'menu'"> 99 Mozilla Bug 249292 100 </a> 101 <a target="_blank" 102 href="https://bugzilla.mozilla.org/show_bug.cgi?id=630486" 103 title="Don't force accessible creation for popup children."> 104 Mozilla Bug 630486 105 </a> 106 <br/> 107 <p id="display"></p> 108 <div id="content" style="display: none"> 109 </div> 110 <pre id="test"> 111 </pre> 112 </body> 113 114 <vbox flex="1"> 115 <menubar> 116 <menu id="menu" label="menu"> 117 <menupopup> 118 <menuitem label="menuitem"/> 119 <menuitem label="menuitem"/> 120 </menupopup> 121 </menu> 122 </menubar> 123 </vbox> 124 </hbox> 125 126 </window>