tor-browser

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

test_aria_alert.html (2333B)


      1 <html>
      2 
      3 <head>
      4  <title>ARIA alert event testing</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="../states.js"></script>
     17  <script type="application/javascript"
     18          src="../events.js"></script>
     19 
     20  <script type="application/javascript">
     21    function showAlert(aID) {
     22      this.DOMNode = document.createElement("div");
     23 
     24      this.invoke = function showAlert_invoke() {
     25        this.DOMNode.setAttribute("role", "alert");
     26        this.DOMNode.setAttribute("id", aID);
     27        var text = document.createTextNode("alert");
     28        this.DOMNode.appendChild(text);
     29        document.body.appendChild(this.DOMNode);
     30      };
     31 
     32      this.getID = function showAlert_getID() {
     33        return "Show ARIA alert " + aID;
     34      };
     35    }
     36 
     37    function changeAlert(aID) {
     38      this.__defineGetter__("DOMNode", function() { return getNode(aID); });
     39 
     40      this.invoke = function changeAlert_invoke() {
     41        this.DOMNode.textContent = "new alert";
     42      };
     43 
     44      this.getID = function showAlert_getID() {
     45        return "Change ARIA alert " + aID;
     46      };
     47    }
     48 
     49    // //////////////////////////////////////////////////////////////////////////
     50    // Do tests
     51 
     52    // gA11yEventDumpToConsole = true; // debuging
     53    // enableLogging("tree,events,verbose");
     54 
     55    var gQueue = null;
     56    function doTests() {
     57      gQueue = new eventQueue(nsIAccessibleEvent.EVENT_ALERT);
     58 
     59      gQueue.push(new showAlert("alert"));
     60      gQueue.push(new changeAlert("alert"));
     61 
     62      gQueue.invoke(); // Will call SimpleTest.finish();
     63    }
     64 
     65    SimpleTest.waitForExplicitFinish();
     66    addA11yLoadEvent(doTests);
     67  </script>
     68 </head>
     69 
     70 <body>
     71 
     72  <a target="_blank"
     73     href="https://bugzilla.mozilla.org/show_bug.cgi?id=591199"
     74     title="mochitest for bug 334386: fire alert event when ARIA alert is shown or new its children are inserted">
     75    Mozilla Bug 591199
     76  </a>
     77 
     78  <p id="display"></p>
     79  <div id="content" style="display: none"></div>
     80  <pre id="test">
     81  </pre>
     82 
     83 </body>
     84 </html>