|
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 type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../common.js"></script> |
|
14 <script type="application/javascript" |
|
15 src="../events.js"></script> |
|
16 |
|
17 <script type="application/javascript" |
|
18 src="../attributes.js"></script> |
|
19 |
|
20 <script type="application/javascript"> |
|
21 |
|
22 /** |
|
23 * Do tests. |
|
24 */ |
|
25 var gQueue = null; |
|
26 |
|
27 // aria grabbed invoker |
|
28 function changeGrabbed(aNodeOrID, aGrabValue) |
|
29 { |
|
30 this.DOMNode = getNode(aNodeOrID); |
|
31 |
|
32 this.invoke = function changeGrabbed_invoke() { |
|
33 if (aGrabValue != undefined) { |
|
34 this.DOMNode.setAttribute("aria-grabbed", aGrabValue); |
|
35 } |
|
36 } |
|
37 |
|
38 this.check = function changeGrabbed_check() { |
|
39 testAttrs(aNodeOrID, {"grabbed" : aGrabValue}, true); |
|
40 } |
|
41 |
|
42 this.getID = function changeGrabbed_getID() { |
|
43 return prettyName(aNodeOrID) + " aria-grabbed changed"; |
|
44 } |
|
45 } |
|
46 |
|
47 // aria dropeffect invoker |
|
48 function changeDropeffect(aNodeOrID, aDropeffectValue) |
|
49 { |
|
50 this.DOMNode = getNode(aNodeOrID); |
|
51 |
|
52 this.invoke = function changeDropeffect_invoke() { |
|
53 if (aDropeffectValue != undefined) { |
|
54 this.DOMNode.setAttribute("aria-dropeffect", aDropeffectValue); |
|
55 } |
|
56 } |
|
57 |
|
58 this.check = function changeDropeffect_check() { |
|
59 testAttrs(aNodeOrID, {"dropeffect" : aDropeffectValue}, true); |
|
60 } |
|
61 |
|
62 this.getID = function changeDropeffect_getID() { |
|
63 return prettyName(aNodeOrID) + " aria-dropeffect changed"; |
|
64 } |
|
65 } |
|
66 |
|
67 function doTests() |
|
68 { |
|
69 // Test aria attribute mutation events |
|
70 gQueue = new eventQueue(nsIAccessibleEvent.EVENT_OBJECT_ATTRIBUTE_CHANGED); |
|
71 |
|
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")); |
|
77 |
|
78 var id="dropregion"; |
|
79 gQueue.push(new changeDropeffect(id, "copy")); |
|
80 gQueue.push(new changeDropeffect(id, "execute")); |
|
81 |
|
82 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
83 } |
|
84 |
|
85 SimpleTest.waitForExplicitFinish(); |
|
86 addA11yLoadEvent(doTests); |
|
87 </script> |
|
88 </head> |
|
89 |
|
90 <body> |
|
91 |
|
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> |
|
97 |
|
98 <p id="display"></p> |
|
99 <div id="content" style="display: none"></div> |
|
100 <pre id="test"> |
|
101 </pre> |
|
102 <div id="eventdump"></div> |
|
103 |
|
104 <!-- ARIA grabbed --> |
|
105 <div id="grabbable" role="button" aria-grabbed="foo">button</div> |
|
106 |
|
107 <!-- ARIA dropeffect --> |
|
108 <div id="dropregion" role="region" aria-dropeffect="none">button</div> |
|
109 </body> |
|
110 </html> |