accessible/tests/mochitest/events/test_dragndrop.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial