tor-browser

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

test_ariahidden.html (3345B)


      1 <html>
      2 
      3 <head>
      4  <title>aria-hidden tree update tests</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    function t1_setARIAHidden() {
     20      this.eventSeq = [
     21        new invokerChecker(EVENT_REORDER, "t1"),
     22      ];
     23 
     24      this.invoke = function t1_setARIAHidden_invoke() {
     25        getNode("t1_child").setAttribute("aria-hidden", "true");
     26      };
     27 
     28      this.finalCheck = function t1_setARIAHidden_finalCheck() {
     29        ok(!isAccessible("t1_child"), "No accessible for aria-hidden");
     30      };
     31 
     32      this.getID = function t1_setARIAHidden_getID() {
     33        return "aria-hidden set to true";
     34      };
     35    }
     36 
     37    function t1_removeARIAHidden() {
     38      this.eventSeq = [
     39        new invokerChecker(EVENT_REORDER, "t1"),
     40      ];
     41 
     42      this.invoke = function t1_removeARIAHidden_invoke() {
     43        getNode("t1_child").removeAttribute("aria-hidden");
     44      };
     45 
     46      this.finalCheck = function t1_removeARIAHidden_finalCheck() {
     47        ok(isAccessible("t1_child"), "No aria-hidden, has to be accessible");
     48      };
     49 
     50      this.getID = function t1_removeARIAHidden_getID() {
     51        return "remove aria-hidden";
     52      };
     53    }
     54 
     55    function t2_setARIAHidden() {
     56      this.eventSeq = [
     57        new invokerChecker(EVENT_REORDER, "t2"),
     58      ];
     59 
     60      this.invoke = function t2_setARIAHidden_invoke() {
     61        getNode("t2_child").setAttribute("aria-hidden", "true");
     62      };
     63 
     64      this.finalCheck = function t2_setARIAHidden_finalCheck() {
     65        testAccessibleTree("t2", { SECTION: []});
     66      };
     67 
     68      this.getID = function t2_setARIAHidden_getID() {
     69        return "t2: set aria-hidden";
     70      };
     71    }
     72 
     73    function t2_insertUnderARIAHidden() {
     74      this.eventSeq = [
     75        new unexpectedInvokerChecker(EVENT_REORDER, "t2"),
     76      ];
     77 
     78      this.invoke = function t2_insertUnderARIAHidden_invoke() {
     79        getNode("t2_child").innerHTML = "<input>";
     80      };
     81 
     82      this.finalCheck = function t2_insertUnderARIAHidden_finalCheck() {
     83        testAccessibleTree("t2", { SECTION: []});
     84      };
     85 
     86      this.getID = function t2_insertUnderARIAHidden_getID() {
     87        return "t2: insert under aria-hidden";
     88      };
     89    }
     90 
     91    // gA11yEventDumpToConsole = true;
     92    function doTests() {
     93      ok(!isAccessible("t1_child"), "No accessible for aria-hidden");
     94 
     95      const gQueue = new eventQueue();
     96      gQueue.push(new t1_removeARIAHidden());
     97      gQueue.push(new t1_setARIAHidden());
     98      gQueue.push(new t2_setARIAHidden());
     99      gQueue.push(new t2_insertUnderARIAHidden());
    100      gQueue.invoke(); // Will call SimpleTest.finish();
    101    }
    102 
    103    SimpleTest.waitForExplicitFinish();
    104    addA11yLoadEvent(doTests);
    105  </script>
    106 </head>
    107 
    108 <body>
    109  <p id="display"></p>
    110  <div id="content" style="display: none"></div>
    111  <pre id="test">
    112  </pre>
    113  <div id="t1"><div id="t1_child" aria-hidden="true">Hi</div><div>there</div></div>
    114  <div id="t2">
    115    <span id="t2_child">hoho</span>
    116  </div>
    117 </body>
    118 </html>