tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_menubutton.xhtml (4184B)


      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 button hierarchy tests">
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
     10  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
     11 
     12  <script type="application/javascript"
     13          src="../common.js" />
     14  <script type="application/javascript"
     15          src="../role.js" />
     16  <script type="application/javascript"
     17          src="../events.js" />
     18 
     19  <script type="application/javascript">
     20  <![CDATA[
     21 
     22    ////////////////////////////////////////////////////////////////////////////
     23    // Invokers
     24 
     25    function openMenu(aButtonID, aIsTree)
     26    {
     27      var menuItemRole = aIsTree ? ROLE_CHECK_MENU_ITEM : ROLE_MENUITEM;
     28      this.button = getAccessible(aButtonID);
     29      this.menupopup = aIsTree ? this.button.nextSibling : this.button.firstChild;
     30 
     31      var checker = new invokerChecker(EVENT_REORDER, this.menupopup);
     32      this.__proto__ = new synthClick(aButtonID, checker);
     33 
     34      let testButton = popup => {
     35        var children = [];
     36        if (!aIsTree) {
     37          children.push(popup);
     38        }
     39        var tree = { PUSHBUTTON: children };
     40        testAccessibleTree(this.button, tree);
     41        testAccessibleTree(this.menupop, popup);
     42      }
     43 
     44      this.invoke = function openMenu_invoke()
     45      {
     46        testButton({ MENUPOPUP: [ ] });
     47        this.__proto__.invoke();
     48      }
     49 
     50      this.finalCheck = function openMenu_finalCheck()
     51      {
     52        testButton({ MENUPOPUP: [
     53          { role: menuItemRole, children: [ ] },
     54          { role: menuItemRole, children: [ ] }
     55        ] });
     56 
     57        synthesizeKey("KEY_Escape");
     58      }
     59 
     60      this.getID = function openMenu_getID()
     61      {
     62        return "open menu of the button " + prettyName(aButtonID);
     63      }
     64    }
     65 
     66    ////////////////////////////////////////////////////////////////////////////
     67    // Do test
     68 
     69    gA11yEventDumpToConsole = true; // debug stuff
     70 
     71    var gQueue = null;
     72 
     73    function doTest()
     74    {
     75      gQueue = new eventQueue();
     76 
     77      gQueue.push(new openMenu("button1"));
     78      gQueue.push(new openMenu("button3"));
     79 
     80      var columnPickerBtn = getAccessible("tree").firstChild.lastChild.previousSibling;
     81      gQueue.push(new openMenu(columnPickerBtn, true));
     82      gQueue.invoke(); // SimpleTest.finish()
     83    }
     84 
     85    SimpleTest.waitForExplicitFinish();
     86    addA11yLoadEvent(doTest);
     87  ]]>
     88  </script>
     89 
     90  <hbox flex="1" style="overflow: auto;">
     91    <body xmlns="http://www.w3.org/1999/xhtml">
     92      <a target="_blank"
     93         href="https://bugzilla.mozilla.org/show_bug.cgi?id=249292"
     94         title="Ensure accessible children for toolbarbutton types 'menu'">
     95        Bug 249292
     96      </a>
     97      <a target="_blank"
     98         href="https://bugzilla.mozilla.org/show_bug.cgi?id=630486"
     99         title="Don't force accessible creation for popup children">
    100        Bug 630486
    101      </a>
    102      <a target="_blank"
    103         href="https://bugzilla.mozilla.org/show_bug.cgi?id=722265"
    104         title="Column header selection popup no longer exposed to accessibility APIs">
    105        Bug 722265
    106      </a>
    107      <br/>
    108      <p id="display"></p>
    109      <div id="content" style="display: none">
    110      </div>
    111      <pre id="test">
    112      </pre>
    113    </body>
    114 
    115    <vbox flex="1">
    116      <button id="button1" type="menu" label="button">
    117        <menupopup>
    118          <menuitem label="menuitem"/>
    119          <menuitem label="menuitem"/>
    120        </menupopup>
    121      </button>
    122 
    123      <toolbarbutton id="button3" type="menu" label="toolbarbutton">
    124        <menupopup>
    125          <menuitem label="menuitem"/>
    126          <menuitem label="menuitem"/>
    127        </menupopup>
    128      </toolbarbutton>
    129 
    130      <tree id="tree" flex="1">
    131        <treecols>
    132          <treecol id="col" flex="1" primary="true" label="column"/>
    133          <treecol id="col2" flex="1" label="another column"/>
    134        </treecols>
    135        <treechildren/>
    136      </tree>
    137    </vbox>
    138  </hbox>
    139 
    140 </window>