tor-browser

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

test_aria_owns.html (3782B)


      1 <html>
      2 
      3 <head>
      4  <title>Aria-owns targets shouldn't be on invalidation list so shouldn't have
      5         show/hide events</title>
      6 
      7  <link rel="stylesheet" type="text/css"
      8        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      9 
     10  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     11  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
     12 
     13  <script type="application/javascript"
     14          src="../common.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 
     22    // //////////////////////////////////////////////////////////////////////////
     23    // Do tests.
     24 
     25    // gA11yEventDumpToConsole = true; // debug stuff
     26    // enableLogging("tree,eventTree,verbose");
     27 
     28    /**
     29     * Aria-owns target shouldn't have a show event.
     30     * Markup:
     31     * <div id="t1_fc" aria-owns="t1_owns"></div>
     32     * <span id="t1_owns"></div>
     33     */
     34    function testAriaOwns() {
     35      this.parent = getNode("t1");
     36      this.fc = document.createElement("div");
     37      this.fc.setAttribute("id", "t1_fc");
     38      this.owns = document.createElement("span");
     39      this.owns.setAttribute("id", "t1_owns");
     40 
     41      this.eventSeq = [
     42        new invokerChecker(EVENT_SHOW, this.fc),
     43        new unexpectedInvokerChecker(EVENT_SHOW, this.owns),
     44      ];
     45 
     46      this.invoke = function testAriaOwns_invoke() {
     47        getNode("t1").appendChild(this.fc);
     48        getNode("t1").appendChild(this.owns);
     49        getNode("t1_fc").setAttribute("aria-owns", "t1_owns");
     50      };
     51 
     52      this.getID = function testAriaOwns_getID() {
     53        return "Aria-owns target shouldn't have show event";
     54      };
     55    }
     56 
     57    /**
     58     * Target of both aria-owns and other aria attribute like aria-labelledby
     59     * shouldn't have a show event.
     60     * Markup:
     61     * <div id="t2_fc" aria-owns="t1_owns"></div>
     62     * <div id="t2_sc" aria-labelledby="t2_owns"></div>
     63     * <span id="t2_owns"></div>
     64     */
     65    function testAriaOwnsAndLabelledBy() {
     66      this.parent = getNode("t2");
     67      this.fc = document.createElement("div");
     68      this.fc.setAttribute("id", "t2_fc");
     69      this.sc = document.createElement("div");
     70      this.sc.setAttribute("id", "t2_sc");
     71      this.owns = document.createElement("span");
     72      this.owns.setAttribute("id", "t2_owns");
     73 
     74      this.eventSeq = [
     75        new invokerChecker(EVENT_SHOW, this.fc),
     76        new invokerChecker(EVENT_SHOW, this.sc),
     77        new unexpectedInvokerChecker(EVENT_SHOW, this.owns),
     78      ];
     79 
     80      this.invoke = function testAriaOwns_invoke() {
     81        getNode("t2").appendChild(this.fc);
     82        getNode("t2").appendChild(this.sc);
     83        getNode("t2").appendChild(this.owns);
     84        getNode("t2_fc").setAttribute("aria-owns", "t2_owns");
     85        getNode("t2_sc").setAttribute("aria-labelledby", "t2_owns");
     86      };
     87 
     88      this.getID = function testAriaOwns_getID() {
     89        return "Aria-owns and aria-labelledby target shouldn't have show event";
     90      };
     91    }
     92 
     93    var gQueue = null;
     94    function doTests() {
     95      gQueue = new eventQueue();
     96      gQueue.push(new testAriaOwns());
     97      gQueue.push(new testAriaOwnsAndLabelledBy());
     98 
     99      gQueue.invoke(); // Will call SimpleTest.finish();
    100    }
    101    SimpleTest.waitForExplicitFinish();
    102    addA11yLoadEvent(doTests);
    103  </script>
    104 </head>
    105 
    106 <body>
    107 
    108  <a target="_blank"
    109     href="https://bugzilla.mozilla.org/show_bug.cgi?id=1296420"
    110     title="Aria-owns targets shouldn't be on invalidation list so shouldn't
    111            have show/hide events">
    112    Mozilla Bug 1296420
    113  </a><br>
    114 
    115  <div id="testContainer">
    116    <div id="t1"></div>
    117 
    118    <div id="t2"></div>
    119  </div>
    120 
    121 </body>
    122 </html>