tor-browser

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

test_general.html (5156B)


      1 <html>
      2 
      3 <head>
      4  <title>Testing the tree updates</title>
      5 
      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    // Invokers
     22    // //////////////////////////////////////////////////////////////////////////
     23 
     24    function prependAppend(aContainer) {
     25      this.eventSeq = [
     26        new invokerChecker(EVENT_REORDER, aContainer),
     27      ];
     28 
     29      this.invoke = function prependAppend_invoke() {
     30        var checkbox = document.createElement("input");
     31        checkbox.setAttribute("type", "checkbox");
     32        getNode(aContainer).insertBefore(checkbox, getNode(aContainer).firstChild);
     33 
     34        var button = document.createElement("input");
     35        button.setAttribute("type", "button");
     36        getNode(aContainer).appendChild(button);
     37      };
     38 
     39      this.finalCheck = function prependAppend_finalCheck() {
     40        var accTree =
     41          { SECTION: [ // container
     42            { CHECKBUTTON: [ ] },
     43            { ENTRY: [ ] },
     44            { PUSHBUTTON: [ ] },
     45          ] };
     46        testAccessibleTree(aContainer, accTree);
     47      };
     48 
     49      this.getID = function prependAppend_getID() {
     50        return "prepends a child and appends a child";
     51      };
     52    }
     53 
     54    function removeRemove(aContainer) {
     55      this.eventSeq = [
     56        new invokerChecker(EVENT_REORDER, aContainer),
     57      ];
     58 
     59      this.invoke = function removeRemove_invoke() {
     60        getNode(aContainer).firstChild.remove();
     61      };
     62 
     63      this.finalCheck = function removeRemove_finalCheck() {
     64        var accTree =
     65          { SECTION: [ // container
     66            { PUSHBUTTON: [ ] },
     67          ] };
     68        testAccessibleTree(aContainer, accTree);
     69      };
     70 
     71      this.getID = function removeRemove_getID() {
     72        return "remove first and second children";
     73      };
     74    }
     75 
     76    function insertInaccessibleAccessibleSiblings() {
     77      this.eventSeq = [
     78        new invokerChecker(EVENT_REORDER, "c3"),
     79      ];
     80 
     81      this.invoke = function insertInaccessibleAccessibleSiblings_invoke() {
     82        getNode("c3").appendChild(document.createElement("span"));
     83        getNode("c3").appendChild(document.createElement("input"));
     84      };
     85 
     86      this.finalCheck = function insertInaccessibleAccessibleSiblings_finalCheck() {
     87        var accTree =
     88          { SECTION: [ // container
     89            { PUSHBUTTON: [
     90              { TEXT_LEAF: [] },
     91            ] },
     92            { ENTRY: [ ] },
     93          ] };
     94        testAccessibleTree("c3", accTree);
     95      };
     96 
     97      this.getID = function insertInaccessibleAccessibleSiblings_getID() {
     98        return "insert inaccessible and then accessible siblings";
     99      };
    100    }
    101 
    102    // Test for bug 1500416.
    103    function displayContentsInsertion() {
    104      this.eventSeq = [
    105        new invokerChecker(EVENT_REORDER, "c4"),
    106      ];
    107 
    108      this.invoke = function displayContentsInsertion_invoke() {
    109        document.body.offsetTop; // Flush layout.
    110 
    111        let list = document.createElement("ul");
    112        list.style.display = "contents";
    113        list.appendChild(document.createElement("li"));
    114        list.firstChild.appendChild(document.createTextNode("Text"));
    115        getNode("c4").appendChild(list);
    116      };
    117 
    118      this.finalCheck = function displayContentsInsertion_finalCheck() {
    119        var accTree =
    120          { SECTION: [ // container
    121            { LIST: [
    122              { LISTITEM: [
    123                { LISTITEM_MARKER: [] },
    124                { TEXT_LEAF: [] },
    125              ] },
    126            ] },
    127          ] };
    128        testAccessibleTree("c4", accTree);
    129      };
    130 
    131      this.getID = function displayContentsInsertion_getID() {
    132        return "insert accessible display: contents element.";
    133      };
    134    }
    135 
    136 
    137    // //////////////////////////////////////////////////////////////////////////
    138    // Do tests
    139    // //////////////////////////////////////////////////////////////////////////
    140 
    141    var gQueue = null;
    142    // gA11yEventDumpID = "eventdump"; // debug stuff
    143    // gA11yEventDumpToConsole = true;
    144 
    145    function doTests() {
    146      gQueue = new eventQueue();
    147 
    148      gQueue.push(new prependAppend("c1"));
    149      gQueue.push(new removeRemove("c2"));
    150      gQueue.push(new insertInaccessibleAccessibleSiblings());
    151      gQueue.push(new displayContentsInsertion());
    152 
    153      gQueue.invoke(); // Will call SimpleTest.finish();
    154    }
    155 
    156    SimpleTest.waitForExplicitFinish();
    157    addA11yLoadEvent(doTests);
    158  </script>
    159 </head>
    160 
    161 <body>
    162  <p id="display"></p>
    163  <div id="content" style="display: none"></div>
    164  <pre id="test">
    165  </pre>
    166 
    167  <div id="c1"><input></div>
    168  <div id="c2"><span><input type="checkbox"><input></span><input type="button"></div>
    169 
    170  <div id="c3"><input type="button" value="button"></div>
    171  <div id="c4"></div>
    172 
    173 </body>
    174 </html>