|
1 <html> |
|
2 |
|
3 <head> |
|
4 <title>ARIA alert 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="../role.js"></script> |
|
16 <script type="application/javascript" |
|
17 src="../states.js"></script> |
|
18 <script type="application/javascript" |
|
19 src="../events.js"></script> |
|
20 |
|
21 <script type="application/javascript"> |
|
22 function showAlert(aID) |
|
23 { |
|
24 this.DOMNode = document.createElement("div"); |
|
25 |
|
26 this.invoke = function showAlert_invoke() |
|
27 { |
|
28 this.DOMNode.setAttribute("role", "alert"); |
|
29 this.DOMNode.setAttribute("id", aID); |
|
30 var text = document.createTextNode("alert"); |
|
31 this.DOMNode.appendChild(text); |
|
32 document.body.appendChild(this.DOMNode); |
|
33 }; |
|
34 |
|
35 this.getID = function showAlert_getID() |
|
36 { |
|
37 return "Show ARIA alert " + aID; |
|
38 }; |
|
39 } |
|
40 |
|
41 function changeAlert(aID) |
|
42 { |
|
43 this.__defineGetter__("DOMNode", function() { return getNode(aID) }); |
|
44 |
|
45 this.invoke = function changeAlert_invoke() |
|
46 { |
|
47 this.DOMNode.textContent = "new alert"; |
|
48 } |
|
49 |
|
50 this.getID = function showAlert_getID() |
|
51 { |
|
52 return "Change ARIA alert " + aID; |
|
53 } |
|
54 } |
|
55 |
|
56 //////////////////////////////////////////////////////////////////////////// |
|
57 // Do tests |
|
58 |
|
59 var gQueue = null; |
|
60 |
|
61 //gA11yEventDumpID = "eventdump"; |
|
62 |
|
63 function doTests() |
|
64 { |
|
65 gQueue = new eventQueue(nsIAccessibleEvent.EVENT_ALERT); |
|
66 |
|
67 gQueue.push(new showAlert("alert")); |
|
68 gQueue.push(new changeAlert("alert")); |
|
69 |
|
70 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
71 } |
|
72 |
|
73 SimpleTest.waitForExplicitFinish(); |
|
74 addA11yLoadEvent(doTests); |
|
75 </script> |
|
76 </head> |
|
77 |
|
78 <body> |
|
79 |
|
80 <a target="_blank" |
|
81 href="https://bugzilla.mozilla.org/show_bug.cgi?id=591199" |
|
82 title="mochitest for bug 334386: fire alert event when ARIA alert is shown or new its children are inserted"> |
|
83 Mozilla Bug 591199 |
|
84 </a> |
|
85 |
|
86 <p id="display"></p> |
|
87 <div id="content" style="display: none"></div> |
|
88 <pre id="test"> |
|
89 </pre> |
|
90 <div id="eventdump"></div> |
|
91 |
|
92 </body> |
|
93 </html> |