accessible/tests/mochitest/events/test_dragndrop.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial