Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 <html>
3 <head>
4 <title>ARIA alert 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="../role.js"></script>
16 <script type="application/javascript"
17 src="../states.js"></script>
18 <script type="application/javascript"
19 src="../events.js"></script>
21 <script type="application/javascript">
22 function showAlert(aID)
23 {
24 this.DOMNode = document.createElement("div");
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 };
35 this.getID = function showAlert_getID()
36 {
37 return "Show ARIA alert " + aID;
38 };
39 }
41 function changeAlert(aID)
42 {
43 this.__defineGetter__("DOMNode", function() { return getNode(aID) });
45 this.invoke = function changeAlert_invoke()
46 {
47 this.DOMNode.textContent = "new alert";
48 }
50 this.getID = function showAlert_getID()
51 {
52 return "Change ARIA alert " + aID;
53 }
54 }
56 ////////////////////////////////////////////////////////////////////////////
57 // Do tests
59 var gQueue = null;
61 //gA11yEventDumpID = "eventdump";
63 function doTests()
64 {
65 gQueue = new eventQueue(nsIAccessibleEvent.EVENT_ALERT);
67 gQueue.push(new showAlert("alert"));
68 gQueue.push(new changeAlert("alert"));
70 gQueue.invoke(); // Will call SimpleTest.finish();
71 }
73 SimpleTest.waitForExplicitFinish();
74 addA11yLoadEvent(doTests);
75 </script>
76 </head>
78 <body>
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>
86 <p id="display"></p>
87 <div id="content" style="display: none"></div>
88 <pre id="test">
89 </pre>
90 <div id="eventdump"></div>
92 </body>
93 </html>