accessible/tests/mochitest/treeupdate/test_menu.xul

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial