1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_focus_dialog.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,164 @@ 1.4 +<html> 1.5 + 1.6 +<head> 1.7 + <title>Accessible focus 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 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.16 + 1.17 + <script type="application/javascript" 1.18 + src="../common.js"></script> 1.19 + <script type="application/javascript" 1.20 + src="../events.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../role.js"></script> 1.23 + <script type="application/javascript" 1.24 + src="../states.js"></script> 1.25 + 1.26 + <script type="application/javascript"> 1.27 + function openCloseDialog(aID) 1.28 + { 1.29 + this.eventSeq = [ 1.30 + new focusChecker(getNode(aID)) 1.31 + ]; 1.32 + 1.33 + this.invoke = function openCloseDialog_invoke() 1.34 + { 1.35 + var wnd = window.open("focus.html"); 1.36 + wnd.close(); 1.37 + } 1.38 + 1.39 + this.getID = function openCloseDialog_getID() 1.40 + { 1.41 + return "Open close dialog while focus on " + prettyName(aID); 1.42 + } 1.43 + } 1.44 + 1.45 + var gDialogWnd = null; 1.46 + function getDialogDocument() 1.47 + { 1.48 + return gDialogWnd.document; 1.49 + } 1.50 + 1.51 + function openDialog(aID) 1.52 + { 1.53 + this.eventSeq = [ 1.54 + new focusChecker(getDialogDocument) 1.55 + ]; 1.56 + 1.57 + this.invoke = function openDialog_invoke() 1.58 + { 1.59 + gDialogWnd = window.open("focus.html"); 1.60 + } 1.61 + 1.62 + this.getID = function openDialog_getID() 1.63 + { 1.64 + return "Open dialog while focus on " + prettyName(aID); 1.65 + } 1.66 + } 1.67 + 1.68 + function closeDialog(aID) 1.69 + { 1.70 + this.eventSeq = [ 1.71 + new focusChecker(aID) 1.72 + ]; 1.73 + 1.74 + this.invoke = function closeDialog_invoke() 1.75 + { 1.76 + gDialogWnd.close(); 1.77 + } 1.78 + 1.79 + this.getID = function closeDialog_getID() 1.80 + { 1.81 + return "Close dialog while focus on " + prettyName(aID); 1.82 + } 1.83 + } 1.84 + 1.85 + function showNFocusAlertDialog() 1.86 + { 1.87 + this.ID = "alertdialog"; 1.88 + this.DOMNode = getNode(this.ID); 1.89 + 1.90 + this.invoke = function showNFocusAlertDialog_invoke() 1.91 + { 1.92 + document.getElementById(this.ID).style.display = 'block'; 1.93 + document.getElementById(this.ID).focus(); 1.94 + } 1.95 + 1.96 + this.eventSeq = [ 1.97 + new invokerChecker(EVENT_SHOW, this.DOMNode), 1.98 + new focusChecker(this.DOMNode) 1.99 + ]; 1.100 + 1.101 + this.getID = function showNFocusAlertDialog_getID() 1.102 + { 1.103 + return "Show and focus alert dialog " + prettyName(this.ID); 1.104 + } 1.105 + } 1.106 + 1.107 + /** 1.108 + * Do tests. 1.109 + */ 1.110 + 1.111 + //gA11yEventDumpID = "eventdump"; // debug stuff 1.112 + //gA11yEventDumpToConsole = true; 1.113 + 1.114 + var gQueue = null; 1.115 + 1.116 + function doTests() 1.117 + { 1.118 + gQueue = new eventQueue(EVENT_FOCUS); 1.119 + 1.120 + gQueue.push(new synthFocus("button")); 1.121 + gQueue.push(new openDialog("button")); 1.122 + gQueue.push(new closeDialog("button")); 1.123 + 1.124 + var frameNode = getNode("editabledoc"); 1.125 + gQueue.push(new synthFocusOnFrame(frameNode)); 1.126 + gQueue.push(new openCloseDialog(frameNode.contentDocument)); 1.127 + 1.128 + gQueue.push(new showNFocusAlertDialog()); 1.129 + 1.130 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.131 + } 1.132 + 1.133 + SimpleTest.waitForExplicitFinish(); 1.134 + addA11yLoadEvent(doTests); 1.135 + </script> 1.136 +</head> 1.137 + 1.138 +<body> 1.139 + 1.140 + <a target="_blank" 1.141 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=551679" 1.142 + title="focus is not fired for focused document when switching between windows"> 1.143 + Mozilla Bug 551679 1.144 + </a> 1.145 + <a target="_blank" 1.146 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=580464" 1.147 + title="Accessible focus incorrect after JS focus() but correct after switching apps or using menu bar"> 1.148 + Mozilla Bug 580464 1.149 + </a> 1.150 + <p id="display"></p> 1.151 + <div id="content" style="display: none"></div> 1.152 + <pre id="test"> 1.153 + </pre> 1.154 + 1.155 + <button id="button">button</button> 1.156 + <iframe id="editabledoc" src="focus.html"></iframe> 1.157 + 1.158 + <div id="alertdialog" style="display: none" tabindex="-1" role="alertdialog" aria-labelledby="title2" aria-describedby="desc2"> 1.159 + <div id="title2">Blah blah</div> 1.160 + <div id="desc2">Woof woof woof.</div> 1.161 + <button>Close</button> 1.162 + </div> 1.163 + 1.164 + 1.165 + <div id="eventdump"></div> 1.166 +</body> 1.167 +</html>