tor-browser

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

test_focus_tree.xhtml (3640B)


      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="XUL tree focus testing">
      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="../treeview.js" />
     14 
     15  <script type="application/javascript"
     16          src="../common.js" />
     17  <script type="application/javascript"
     18          src="../role.js" />
     19  <script type="application/javascript"
     20          src="../states.js" />
     21  <script type="application/javascript"
     22          src="../events.js" />
     23 
     24  <script type="application/javascript">
     25  <![CDATA[
     26 
     27    ////////////////////////////////////////////////////////////////////////////
     28    // Invokers
     29 
     30    function focusTree(aTreeID)
     31    {
     32      var checker = new focusChecker(getFirstTreeItem, aTreeID);
     33      this.__proto__ = new synthFocus(aTreeID, [ checker ]);
     34    }
     35 
     36    function moveToNextItem(aTreeID)
     37    {
     38      var checker = new focusChecker(getSecondTreeItem, aTreeID);
     39      this.__proto__ = new synthDownKey(aTreeID, [ checker ]);
     40    }
     41 
     42    ////////////////////////////////////////////////////////////////////////////
     43    // Helpers
     44 
     45    function getTreeItemAt(aTreeID, aIdx)
     46      { return getAccessible(aTreeID).getChildAt(aIdx + 1); }
     47 
     48    function getFirstTreeItem(aTreeID)
     49      { return getTreeItemAt(aTreeID, 0); }
     50 
     51    function getSecondTreeItem(aTreeID)
     52      { return getTreeItemAt(aTreeID, 1); }
     53 
     54    ////////////////////////////////////////////////////////////////////////////
     55    // Test
     56 
     57    var gQueue = null;
     58 
     59    //gA11yEventDumpID = "debug"; // debugging
     60    //gA11yEventDumpToConsole = true; // debugging
     61 
     62    function doTest()
     63    {
     64      gQueue = new eventQueue();
     65 
     66      gQueue.push(new focusTree("tree"));
     67      gQueue.push(new moveToNextItem("tree"));
     68      gQueue.push(new synthFocus("emptytree"));
     69 
     70      // no focus event for changed current item for unfocused tree
     71      gQueue.push(new changeCurrentItem("tree", 0));
     72 
     73      gQueue.invoke();
     74    }
     75 
     76    SimpleTest.waitForExplicitFinish();
     77    addA11yXULTreeLoadEvent(doTest, "tree", new nsTableTreeView(5));
     78  ]]>
     79  </script>
     80 
     81  <hbox flex="1" style="overflow: auto;">
     82    <body xmlns="http://www.w3.org/1999/xhtml">
     83      <a target="_blank"
     84         href="https://bugzilla.mozilla.org/show_bug.cgi?id=386821"
     85         title="Need better solution for firing delayed event against xul tree">
     86        Mozilla Bug 386821
     87      </a>
     88      <a target="_blank"
     89         href="https://bugzilla.mozilla.org/show_bug.cgi?id=406308"
     90         title="Don't fire accessible focus events if widget is not actually in focus, confuses screen readers">
     91        Mozilla Bug 406308
     92      </a>
     93      <p id="display"></p>
     94      <div id="content" style="display: none">
     95      </div>
     96      <pre id="test">
     97      </pre>
     98    </body>
     99 
    100    <vbox id="debug"/>
    101    <tree id="tree" flex="1">
    102      <treecols>
    103        <treecol id="col1" flex="1" primary="true" label="column"/>
    104        <treecol id="col2" flex="1" label="column 2"/>
    105      </treecols>
    106      <treechildren id="treechildren"/>
    107    </tree>
    108    <tree id="emptytree" flex="1">
    109      <treecols>
    110        <treecol id="emptytree_col1" flex="1" primary="true" label="column"/>
    111        <treecol id="emptytree_col2" flex="1" label="column 2"/>
    112      </treecols>
    113      <treechildren id="emptytree_treechildren"/>
    114    </tree>
    115  </hbox>
    116 
    117 </window>