tor-browser

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

test_list.html (3716B)


      1 <!DOCTYPE html>
      2 <html>
      3 
      4 <head>
      5  <title>Test HTML li and listitem bullet accessible cache</title>
      6  <link rel="stylesheet" type="text/css"
      7        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     10 
     11  <script type="application/javascript"
     12          src="../common.js"></script>
     13  <script type="application/javascript"
     14          src="../role.js"></script>
     15  <script type="application/javascript"
     16          src="../events.js"></script>
     17 
     18  <script type="application/javascript">
     19 
     20    // //////////////////////////////////////////////////////////////////////////
     21    // Helpers
     22 
     23    function testLiAccessibleTree() {
     24      // Test accessible tree.
     25      var accTree = {
     26        role: ROLE_LISTITEM,
     27        children: [
     28          {
     29            role: ROLE_LISTITEM_MARKER,
     30            children: [],
     31          },
     32          {
     33            role: ROLE_TEXT_LEAF,
     34            children: [],
     35          },
     36        ],
     37      };
     38 
     39      testAccessibleTree("li", accTree);
     40    }
     41 
     42    // //////////////////////////////////////////////////////////////////////////
     43    // Sequence item processors
     44 
     45    function hideProcessor() {
     46      this.liNode = getNode("li");
     47      this.li = getAccessible(this.liNode);
     48      this.bullet = this.li.firstChild;
     49 
     50      this.process = function hideProcessor_process() {
     51        this.liNode.style.display = "none";
     52      };
     53 
     54      this.onProcessed = function hideProcessor_onProcessed() {
     55        window.setTimeout(
     56          function(aLiAcc, aLiNode, aBulletAcc) {
     57            testDefunctAccessible(aLiAcc, aLiNode);
     58            testDefunctAccessible(aBulletAcc);
     59 
     60            gSequence.processNext();
     61          },
     62          0, this.li, this.liNode, this.bullet
     63        );
     64      };
     65    }
     66 
     67    function showProcessor() {
     68      this.liNode = getNode("li");
     69 
     70      this.process = function showProcessor_process() {
     71        this.liNode.style.display = "list-item";
     72      };
     73 
     74      this.onProcessed = function showProcessor_onProcessed() {
     75        testLiAccessibleTree();
     76        gSequence.processNext();
     77      };
     78    }
     79 
     80    function textReplaceProcessor() {
     81      this.liNode = getNode("li");
     82 
     83      this.process = function textReplaceProcessor_process() {
     84        this.liNode.textContent = "hey";
     85      };
     86 
     87      this.onProcessed = function textReplaceProcessor_onProcessed() {
     88        var tree = {
     89          LISTITEM: [
     90            { LISTITEM_MARKER: [] },
     91            { TEXT_LEAF: [] },
     92          ],
     93        };
     94        testAccessibleTree(this.liNode, tree);
     95        SimpleTest.finish();
     96      };
     97    }
     98 
     99    // //////////////////////////////////////////////////////////////////////////
    100    // Test
    101 
    102    // gA11yEventDumpToConsole = true;
    103 
    104    var gSequence = null;
    105    function doTest() {
    106      testLiAccessibleTree();
    107 
    108      gSequence = new sequence();
    109 
    110      gSequence.append(new hideProcessor(), EVENT_HIDE, getAccessible("li"),
    111                       "hide HTML li");
    112      gSequence.append(new showProcessor(), EVENT_SHOW, getNode("li"),
    113                       "show HTML li");
    114      gSequence.append(new textReplaceProcessor(), EVENT_REORDER, getNode("li"),
    115                       "change text of HTML li");
    116 
    117      gSequence.processNext(); // SimpleTest.finish() will be called in the end
    118    }
    119 
    120    SimpleTest.waitForExplicitFinish();
    121    addA11yLoadEvent(doTest);
    122  </script>
    123 </head>
    124 <body>
    125 
    126  <a target="_blank"
    127     title="setParent shouldn't be virtual"
    128     href="https://bugzilla.mozilla.org/show_bug.cgi?id=496783">Mozilla Bug 496783</a>
    129 
    130  <p id="display"></p>
    131  <div id="content" style="display: none"></div>
    132  <pre id="test">
    133  </pre>
    134 
    135  <ul>
    136    <li id="li">item1</li>
    137  </ul>
    138 </body>
    139 </html>