1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_aria_alert.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,93 @@ 1.4 +<html> 1.5 + 1.6 +<head> 1.7 + <title>ARIA alert event testing</title> 1.8 + 1.9 + <link rel="stylesheet" type="text/css" 1.10 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../common.js"></script> 1.17 + <script type="application/javascript" 1.18 + src="../role.js"></script> 1.19 + <script type="application/javascript" 1.20 + src="../states.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../events.js"></script> 1.23 + 1.24 + <script type="application/javascript"> 1.25 + function showAlert(aID) 1.26 + { 1.27 + this.DOMNode = document.createElement("div"); 1.28 + 1.29 + this.invoke = function showAlert_invoke() 1.30 + { 1.31 + this.DOMNode.setAttribute("role", "alert"); 1.32 + this.DOMNode.setAttribute("id", aID); 1.33 + var text = document.createTextNode("alert"); 1.34 + this.DOMNode.appendChild(text); 1.35 + document.body.appendChild(this.DOMNode); 1.36 + }; 1.37 + 1.38 + this.getID = function showAlert_getID() 1.39 + { 1.40 + return "Show ARIA alert " + aID; 1.41 + }; 1.42 + } 1.43 + 1.44 + function changeAlert(aID) 1.45 + { 1.46 + this.__defineGetter__("DOMNode", function() { return getNode(aID) }); 1.47 + 1.48 + this.invoke = function changeAlert_invoke() 1.49 + { 1.50 + this.DOMNode.textContent = "new alert"; 1.51 + } 1.52 + 1.53 + this.getID = function showAlert_getID() 1.54 + { 1.55 + return "Change ARIA alert " + aID; 1.56 + } 1.57 + } 1.58 + 1.59 + //////////////////////////////////////////////////////////////////////////// 1.60 + // Do tests 1.61 + 1.62 + var gQueue = null; 1.63 + 1.64 + //gA11yEventDumpID = "eventdump"; 1.65 + 1.66 + function doTests() 1.67 + { 1.68 + gQueue = new eventQueue(nsIAccessibleEvent.EVENT_ALERT); 1.69 + 1.70 + gQueue.push(new showAlert("alert")); 1.71 + gQueue.push(new changeAlert("alert")); 1.72 + 1.73 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.74 + } 1.75 + 1.76 + SimpleTest.waitForExplicitFinish(); 1.77 + addA11yLoadEvent(doTests); 1.78 + </script> 1.79 +</head> 1.80 + 1.81 +<body> 1.82 + 1.83 + <a target="_blank" 1.84 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=591199" 1.85 + title="mochitest for bug 334386: fire alert event when ARIA alert is shown or new its children are inserted"> 1.86 + Mozilla Bug 591199 1.87 + </a> 1.88 + 1.89 + <p id="display"></p> 1.90 + <div id="content" style="display: none"></div> 1.91 + <pre id="test"> 1.92 + </pre> 1.93 + <div id="eventdump"></div> 1.94 + 1.95 +</body> 1.96 +</html>