tor-browser

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

test_tree.xhtml (3550B)


      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 tree actions tests">
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
     10 
     11  <script type="application/javascript"
     12          src="../treeview.js" />
     13 
     14  <script type="application/javascript"
     15          src="../common.js" />
     16  <script type="application/javascript"
     17          src="../role.js" />
     18  <script type="application/javascript"
     19          src="../states.js" />
     20  <script type="application/javascript"
     21          src="../events.js" />
     22  <script type="application/javascript"
     23          src="../actions.js" />
     24 
     25  <script type="application/javascript">
     26  <![CDATA[
     27    ////////////////////////////////////////////////////////////////////////////
     28    // Accessible tree testers
     29 
     30    function stateFocusChecker(aAcc, aStates)
     31    {
     32      this.__proto__ = new focusChecker(aAcc);
     33 
     34      this.check = function focusChecker_check()
     35      {
     36        var states = aStates ? aStates : 0;
     37        testStates(this.target, STATE_FOCUSED | STATE_SELECTED | states);
     38      }
     39    }
     40 
     41    ////////////////////////////////////////////////////////////////////////////
     42    // Test
     43 
     44    // gA11yEventDumpID = "debug";
     45    //gA11yEventDumpToConsole = true; // debug
     46 
     47    function doTest()
     48    {
     49      var treeNode = getNode("tree");
     50 
     51      var treeBodyNode = treeNode.treeBody;
     52 
     53      var tree = getAccessible(treeNode);
     54      var expandedTreeItem = tree.getChildAt(2);
     55      var collapsedTreeItem = tree.getChildAt(5);
     56 
     57      var actions = [
     58        {
     59          ID: expandedTreeItem,
     60          actionName: "activate",
     61          actionIndex: 0,
     62          events: CLICK_EVENTS,
     63          targetID: treeBodyNode,
     64          eventSeq: [
     65            new stateFocusChecker(expandedTreeItem, STATE_EXPANDED)
     66          ]
     67        },
     68        {
     69          ID: collapsedTreeItem,
     70          actionName: "expand",
     71          actionIndex: 1,
     72          events: CLICK_EVENTS,
     73          targetID: treeBodyNode,
     74          checkOnClickEvent: function check()
     75          {
     76            testStates(this.ID, STATE_EXPANDED);
     77          }
     78        },
     79        {
     80          ID: collapsedTreeItem,
     81          actionName: "collapse",
     82          actionIndex: 1,
     83          events: CLICK_EVENTS,
     84          targetID: treeBodyNode,
     85          checkOnClickEvent: function check()
     86          {
     87            testStates(this.ID, STATE_COLLAPSED);
     88          }
     89        }
     90      ];
     91 
     92      testActions(actions); // Will call SimpleTest.finish();
     93    }
     94 
     95    SimpleTest.waitForExplicitFinish();
     96    addA11yXULTreeLoadEvent(doTest, "tree", new nsTreeTreeView());
     97  ]]>
     98  </script>
     99 
    100  <hbox flex="1" style="overflow: auto;">
    101    <body xmlns="http://www.w3.org/1999/xhtml">
    102      <a target="_blank" rel="opener"
    103         href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727"
    104         title="Reorganize implementation of XUL tree accessibility">
    105        Mozilla Bug 503727
    106      </a><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      <tree id="tree" flex="1" minheight="100px">
    116        <treecols>
    117          <treecol id="col" flex="1" primary="true" label="column"/>
    118        </treecols>
    119        <treechildren/>
    120      </tree>
    121 
    122      <vbox id="debug"/>
    123    </vbox>
    124  </hbox>
    125 
    126 </window>