accessible/tests/mochitest/events/test_dragndrop.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/events/test_dragndrop.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,110 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>Accessible drag and drop event testing</title>
     1.8 +
     1.9 +  <link rel="stylesheet" type="text/css"
    1.10 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +
    1.15 +  <script type="application/javascript"
    1.16 +          src="../common.js"></script>
    1.17 +  <script type="application/javascript"
    1.18 +          src="../events.js"></script>
    1.19 +
    1.20 +  <script type="application/javascript"
    1.21 +          src="../attributes.js"></script>
    1.22 +
    1.23 +  <script type="application/javascript">
    1.24 +
    1.25 +    /**
    1.26 +     * Do tests.
    1.27 +     */
    1.28 +    var gQueue = null;
    1.29 +
    1.30 +    // aria grabbed invoker
    1.31 +    function changeGrabbed(aNodeOrID, aGrabValue)
    1.32 +    {
    1.33 +      this.DOMNode = getNode(aNodeOrID);
    1.34 +
    1.35 +      this.invoke = function changeGrabbed_invoke() {
    1.36 +        if (aGrabValue != undefined) {
    1.37 +          this.DOMNode.setAttribute("aria-grabbed", aGrabValue);
    1.38 +        }
    1.39 +      }
    1.40 +
    1.41 +      this.check = function changeGrabbed_check() {
    1.42 +        testAttrs(aNodeOrID, {"grabbed" : aGrabValue}, true);
    1.43 +      }
    1.44 +
    1.45 +      this.getID = function changeGrabbed_getID() {
    1.46 +        return prettyName(aNodeOrID) + " aria-grabbed changed";
    1.47 +      }
    1.48 +    }
    1.49 +
    1.50 +    // aria dropeffect invoker
    1.51 +    function changeDropeffect(aNodeOrID, aDropeffectValue)
    1.52 +    {
    1.53 +      this.DOMNode = getNode(aNodeOrID);
    1.54 +
    1.55 +      this.invoke = function changeDropeffect_invoke() {
    1.56 +        if (aDropeffectValue != undefined) {
    1.57 +          this.DOMNode.setAttribute("aria-dropeffect", aDropeffectValue);
    1.58 +        }
    1.59 +      }
    1.60 +
    1.61 +      this.check = function changeDropeffect_check() {
    1.62 +        testAttrs(aNodeOrID, {"dropeffect" : aDropeffectValue}, true);
    1.63 +      }
    1.64 +
    1.65 +      this.getID = function changeDropeffect_getID() {
    1.66 +        return prettyName(aNodeOrID) + " aria-dropeffect changed";
    1.67 +      }
    1.68 +    }
    1.69 +
    1.70 +    function doTests()
    1.71 +    {
    1.72 +      // Test aria attribute mutation events
    1.73 +      gQueue = new eventQueue(nsIAccessibleEvent.EVENT_OBJECT_ATTRIBUTE_CHANGED);
    1.74 +
    1.75 +      var id="grabbable";
    1.76 +      gQueue.push(new changeGrabbed(id, "true"));
    1.77 +      gQueue.push(new changeGrabbed(id, "false"));
    1.78 +      todo(false, "uncomment this test when 472142 is fixed.");
    1.79 +      //gQueue.push(new changeGrabbed(id, "undefined"));
    1.80 +
    1.81 +      var id="dropregion";
    1.82 +      gQueue.push(new changeDropeffect(id, "copy"));
    1.83 +      gQueue.push(new changeDropeffect(id, "execute"));
    1.84 +
    1.85 +      gQueue.invoke(); // Will call SimpleTest.finish();
    1.86 +    }
    1.87 +
    1.88 +    SimpleTest.waitForExplicitFinish();
    1.89 +    addA11yLoadEvent(doTests);
    1.90 +  </script>
    1.91 +</head>
    1.92 +
    1.93 +<body>
    1.94 +
    1.95 +  <a target="_blank"
    1.96 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=510441"
    1.97 +     title="Add support for nsIAccessibleEvent::OBJECT_ATTRIBUTE_CHANGED">
    1.98 +    Mozilla Bug 510441
    1.99 +  </a>
   1.100 +
   1.101 +  <p id="display"></p>
   1.102 +  <div id="content" style="display: none"></div>
   1.103 +  <pre id="test">
   1.104 +  </pre>
   1.105 +  <div id="eventdump"></div>
   1.106 +
   1.107 +  <!-- ARIA grabbed -->
   1.108 +  <div id="grabbable" role="button" aria-grabbed="foo">button</div>
   1.109 +
   1.110 +  <!-- ARIA dropeffect -->
   1.111 +  <div id="dropregion" role="region" aria-dropeffect="none">button</div>
   1.112 +</body>
   1.113 +</html>

mercurial