Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <html> |
michael@0 | 2 | |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Accessible document focus event testing</title> |
michael@0 | 5 | |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js"></script> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../events.js"></script> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../role.js"></script> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../states.js"></script> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | var gQueue = null; |
michael@0 | 25 | |
michael@0 | 26 | //var gA11yEventDumpID = "eventdump"; |
michael@0 | 27 | //gA11yEventDumpToConsole = true; |
michael@0 | 28 | |
michael@0 | 29 | function doTests() |
michael@0 | 30 | { |
michael@0 | 31 | // setup |
michael@0 | 32 | var frameDoc = document.getElementById("iframe").contentDocument; |
michael@0 | 33 | frameDoc.designMode = "on"; |
michael@0 | 34 | var frameDocAcc = getAccessible(frameDoc, [nsIAccessibleDocument]); |
michael@0 | 35 | var buttonAcc = getAccessible("b1"); |
michael@0 | 36 | |
michael@0 | 37 | var frame2Doc = document.getElementById("iframe2").contentDocument; |
michael@0 | 38 | var frame2Input = frame2Doc.getElementById("input"); |
michael@0 | 39 | var frame2DocAcc = getAccessible(frame2Doc); |
michael@0 | 40 | var frame2InputAcc = getAccessible(frame2Input); |
michael@0 | 41 | |
michael@0 | 42 | // Test focus events. |
michael@0 | 43 | gQueue = new eventQueue(); |
michael@0 | 44 | |
michael@0 | 45 | // try to give focus to contentEditable frame twice to cover bug 512059 |
michael@0 | 46 | gQueue.push(new synthFocus(buttonAcc)); |
michael@0 | 47 | gQueue.push(new synthTab(frameDocAcc, new focusChecker(frameDocAcc))); |
michael@0 | 48 | gQueue.push(new synthFocus(buttonAcc)); |
michael@0 | 49 | gQueue.push(new synthTab(frameDocAcc, new focusChecker(frameDocAcc))); |
michael@0 | 50 | |
michael@0 | 51 | // focus on not editable document |
michael@0 | 52 | gQueue.push(new synthFocus(frame2InputAcc)); |
michael@0 | 53 | gQueue.push(new synthShiftTab(frame2DocAcc, new focusChecker(frame2DocAcc))); |
michael@0 | 54 | |
michael@0 | 55 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 59 | addA11yLoadEvent(doTests); |
michael@0 | 60 | </script> |
michael@0 | 61 | </head> |
michael@0 | 62 | |
michael@0 | 63 | <body> |
michael@0 | 64 | |
michael@0 | 65 | <a target="_blank" |
michael@0 | 66 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=512058" |
michael@0 | 67 | title="Can't set focus to designMode document via accessibility APIs"> |
michael@0 | 68 | Mozilla Bug 512058 |
michael@0 | 69 | </a> |
michael@0 | 70 | <a target="_blank" |
michael@0 | 71 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=512059" |
michael@0 | 72 | title="Accessibility focus event never fired for designMode document after the first focus"> |
michael@0 | 73 | Mozilla Bug 512059 |
michael@0 | 74 | </a> |
michael@0 | 75 | <a target="_blank" |
michael@0 | 76 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=618046" |
michael@0 | 77 | title="No focus change event when Shift+Tab at top of screen"> |
michael@0 | 78 | Mozilla Bug 618046 |
michael@0 | 79 | </a> |
michael@0 | 80 | |
michael@0 | 81 | <p id="display"></p> |
michael@0 | 82 | <div id="content" style="display: none"></div> |
michael@0 | 83 | <pre id="test"> |
michael@0 | 84 | </pre> |
michael@0 | 85 | |
michael@0 | 86 | <div id="eventdump"></div> |
michael@0 | 87 | |
michael@0 | 88 | <div id="testContainer"> |
michael@0 | 89 | <button id="b1">a button</button> |
michael@0 | 90 | <iframe id="iframe" src="about:blank"></iframe> |
michael@0 | 91 | <button id="b2">a button</button> |
michael@0 | 92 | <iframe id="iframe2" src="data:text/html,<html><input id='input'></html>"></iframe> |
michael@0 | 93 | </div> |
michael@0 | 94 | </body> |
michael@0 | 95 | </html> |