tor-browser

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

test_dragndrop.html (3001B)


      1 <html>
      2 
      3 <head>
      4  <title>Accessible drag and drop 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="../events.js"></script>
     15 
     16  <script type="application/javascript"
     17          src="../attributes.js"></script>
     18 
     19  <script type="application/javascript">
     20 
     21    /**
     22     * Do tests.
     23     */
     24    var gQueue = null;
     25 
     26    // aria grabbed invoker
     27    function changeGrabbed(aNodeOrID, aGrabValue) {
     28      this.DOMNode = getNode(aNodeOrID);
     29 
     30      this.invoke = function changeGrabbed_invoke() {
     31        if (aGrabValue != undefined) {
     32          this.DOMNode.setAttribute("aria-grabbed", aGrabValue);
     33        }
     34      };
     35 
     36      this.check = function changeGrabbed_check() {
     37        testAttrs(aNodeOrID, {"grabbed": aGrabValue}, true);
     38      };
     39 
     40      this.getID = function changeGrabbed_getID() {
     41        return prettyName(aNodeOrID) + " aria-grabbed changed";
     42      };
     43    }
     44 
     45    // aria dropeffect invoker
     46    function changeDropeffect(aNodeOrID, aDropeffectValue) {
     47      this.DOMNode = getNode(aNodeOrID);
     48 
     49      this.invoke = function changeDropeffect_invoke() {
     50        if (aDropeffectValue != undefined) {
     51          this.DOMNode.setAttribute("aria-dropeffect", aDropeffectValue);
     52        }
     53      };
     54 
     55      this.check = function changeDropeffect_check() {
     56        testAttrs(aNodeOrID, {"dropeffect": aDropeffectValue}, true);
     57      };
     58 
     59      this.getID = function changeDropeffect_getID() {
     60        return prettyName(aNodeOrID) + " aria-dropeffect changed";
     61      };
     62    }
     63 
     64    function doTests() {
     65      // Test aria attribute mutation events
     66      gQueue = new eventQueue(nsIAccessibleEvent.EVENT_OBJECT_ATTRIBUTE_CHANGED);
     67 
     68      let id = "grabbable";
     69      gQueue.push(new changeGrabbed(id, "true"));
     70      gQueue.push(new changeGrabbed(id, "false"));
     71      todo(false, "uncomment this test when 472142 is fixed.");
     72      // gQueue.push(new changeGrabbed(id, "undefined"));
     73 
     74      id = "dropregion";
     75      gQueue.push(new changeDropeffect(id, "copy"));
     76      gQueue.push(new changeDropeffect(id, "execute"));
     77 
     78      gQueue.invoke(); // Will call SimpleTest.finish();
     79    }
     80 
     81    SimpleTest.waitForExplicitFinish();
     82    addA11yLoadEvent(doTests);
     83  </script>
     84 </head>
     85 
     86 <body>
     87 
     88  <a target="_blank"
     89     href="https://bugzilla.mozilla.org/show_bug.cgi?id=510441"
     90     title="Add support for nsIAccessibleEvent::OBJECT_ATTRIBUTE_CHANGED">
     91    Mozilla Bug 510441
     92  </a>
     93 
     94  <p id="display"></p>
     95  <div id="content" style="display: none"></div>
     96  <pre id="test">
     97  </pre>
     98  <div id="eventdump"></div>
     99 
    100  <!-- ARIA grabbed -->
    101  <div id="grabbable" role="button" aria-grabbed="foo">button</div>
    102 
    103  <!-- ARIA dropeffect -->
    104  <div id="dropregion" role="region" aria-dropeffect="none">button</div>
    105 </body>
    106 </html>