1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_focus_general.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,179 @@ 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="../role.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../events.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 focusElmWhileSubdocIsFocused(aID) 1.28 + { 1.29 + this.DOMNode = getNode(aID); 1.30 + 1.31 + this.invoke = function focusElmWhileSubdocIsFocused_invoke() 1.32 + { 1.33 + this.DOMNode.focus(); 1.34 + } 1.35 + 1.36 + this.eventSeq = [ 1.37 + new focusChecker(this.DOMNode) 1.38 + ]; 1.39 + 1.40 + this.unexpectedEventSeq = [ 1.41 + new invokerChecker(EVENT_FOCUS, this.DOMNode.ownerDocument) 1.42 + ]; 1.43 + 1.44 + this.getID = function focusElmWhileSubdocIsFocused_getID() 1.45 + { 1.46 + return "Focus element while subdocument is focused " + prettyName(aID); 1.47 + } 1.48 + } 1.49 + 1.50 + function imageMapChecker(aID) 1.51 + { 1.52 + var node = getNode(aID); 1.53 + this.type = EVENT_FOCUS; 1.54 + this.match = function imageMapChecker_match(aEvent) 1.55 + { 1.56 + return aEvent.DOMNode == node; 1.57 + } 1.58 + } 1.59 + 1.60 + function topMenuChecker() 1.61 + { 1.62 + this.type = EVENT_FOCUS; 1.63 + this.match = function topMenuChecker_match(aEvent) 1.64 + { 1.65 + return aEvent.accessible.role == ROLE_PARENT_MENUITEM; 1.66 + } 1.67 + } 1.68 + 1.69 + function contextMenuChecker() 1.70 + { 1.71 + this.type = EVENT_MENUPOPUP_START; 1.72 + this.match = function contextMenuChecker_match(aEvent) 1.73 + { 1.74 + return aEvent.accessible.role == ROLE_MENUPOPUP; 1.75 + } 1.76 + } 1.77 + 1.78 + function focusContextMenuItemChecker() 1.79 + { 1.80 + this.__proto__ = new focusChecker(); 1.81 + 1.82 + this.match = function focusContextMenuItemChecker_match(aEvent) 1.83 + { 1.84 + return aEvent.accessible.role == ROLE_MENUITEM; 1.85 + } 1.86 + } 1.87 + 1.88 + /** 1.89 + * Do tests. 1.90 + */ 1.91 + 1.92 + //gA11yEventDumpID = "eventdump"; // debug stuff 1.93 + //gA11yEventDumpToConsole = true; 1.94 + 1.95 + var gQueue = null; 1.96 + 1.97 + function doTests() 1.98 + { 1.99 + var frameDoc = document.getElementById("iframe").contentDocument; 1.100 + 1.101 + var editableDoc = document.getElementById('editabledoc').contentDocument; 1.102 + editableDoc.designMode = 'on'; 1.103 + 1.104 + gQueue = new eventQueue(); 1.105 + 1.106 + gQueue.push(new synthFocus("editablearea")); 1.107 + gQueue.push(new synthFocus("navarea")); 1.108 + gQueue.push(new synthTab("navarea", new focusChecker(frameDoc))); 1.109 + gQueue.push(new focusElmWhileSubdocIsFocused("link")); 1.110 + 1.111 + gQueue.push(new synthTab(editableDoc, new focusChecker(editableDoc))); 1.112 + if (WIN || LINUX) { 1.113 + // Alt key is used to active menubar and focus menu item on Windows, 1.114 + // other platforms requires setting a ui.key.menuAccessKeyFocuses 1.115 + // preference. 1.116 + gQueue.push(new toggleTopMenu(editableDoc, new topMenuChecker())); 1.117 + gQueue.push(new toggleTopMenu(editableDoc, new focusChecker(editableDoc))); 1.118 + } 1.119 + gQueue.push(new synthContextMenu(editableDoc, new contextMenuChecker())); 1.120 + gQueue.push(new synthDownKey(editableDoc, new focusContextMenuItemChecker())); 1.121 + gQueue.push(new synthEscapeKey(editableDoc, new focusChecker(editableDoc))); 1.122 + if (SEAMONKEY) { 1.123 + todo(false, "shift tab from editable document fails on (Windows) SeaMonkey! (Bug 718235)"); 1.124 + } else { 1.125 + if (LINUX || MAC) 1.126 + todo(false, "shift tab from editable document fails on linux and Mac, bug 746519!"); 1.127 + else 1.128 + gQueue.push(new synthShiftTab("link", new focusChecker("link"))); 1.129 + } // ! SEAMONKEY 1.130 + 1.131 + gQueue.push(new synthFocus("a", new imageMapChecker("a"))); 1.132 + gQueue.push(new synthFocus("b", new imageMapChecker("b"))); 1.133 + 1.134 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.135 + } 1.136 + 1.137 + SimpleTest.waitForExplicitFinish(); 1.138 + addA11yLoadEvent(doTests); 1.139 + </script> 1.140 +</head> 1.141 + 1.142 +<body> 1.143 + <a target="_blank" 1.144 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=352220" 1.145 + title="Inconsistent focus events when returning to a document frame"> 1.146 + Mozilla Bug 352220 1.147 + </a> 1.148 + <a target="_blank" 1.149 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=550338" 1.150 + title="Broken focus when returning to editable documents from menus"> 1.151 + Mozilla Bug 550338 1.152 + </a> 1.153 + <a target="_blank" 1.154 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" 1.155 + title="Rework accessible focus handling"> 1.156 + Mozilla Bug 673958 1.157 + </a> 1.158 + <a target="_blank" 1.159 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=961696" 1.160 + title="Accessible object:state-changed:focused events for imagemap links are broken"> 1.161 + Mozilla Bug 961696 1.162 + </a> 1.163 + <p id="display"></p> 1.164 + <div id="content" style="display: none"></div> 1.165 + <pre id="test"> 1.166 + </pre> 1.167 + 1.168 + <div id="editablearea" contentEditable="true">editable area</div> 1.169 + <div id="navarea" tabindex="0">navigable area</div> 1.170 + <iframe id="iframe" src="data:text/html,<html></html>"></iframe> 1.171 + <a id="link" href="">link</a> 1.172 + <iframe id="editabledoc" src="about:blank"></iframe> 1.173 + 1.174 + <map name="atoz_map"> 1.175 + <area id="a" coords="0,0,13,14" shape="rect"> 1.176 + <area id="b" coords="17,0,30,14" shape="rect"> 1.177 + </map> 1.178 + <img width="447" height="15" usemap="#atoz_map" src="../letters.gif"> 1.179 + 1.180 + <div id="eventdump"></div> 1.181 +</body> 1.182 +</html>