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>CSS overflow 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 | <style> |
michael@0 | 10 | a.link:focus { |
michael@0 | 11 | overflow: scroll; |
michael@0 | 12 | } |
michael@0 | 13 | </style> |
michael@0 | 14 | |
michael@0 | 15 | <script type="application/javascript" |
michael@0 | 16 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 17 | <script type="application/javascript" |
michael@0 | 18 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 19 | |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../common.js"></script> |
michael@0 | 22 | <script type="application/javascript" |
michael@0 | 23 | src="../events.js"></script> |
michael@0 | 24 | |
michael@0 | 25 | <script type="application/javascript"> |
michael@0 | 26 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 27 | // Invokers |
michael@0 | 28 | |
michael@0 | 29 | function focusAnchor(aID) |
michael@0 | 30 | { |
michael@0 | 31 | this.linkNode = getNode(aID); |
michael@0 | 32 | this.link = getAccessible(this.linkNode); |
michael@0 | 33 | |
michael@0 | 34 | this.eventSeq = [ |
michael@0 | 35 | new invokerChecker(EVENT_FOCUS, getAccessible, this.linkNode) |
michael@0 | 36 | ]; |
michael@0 | 37 | |
michael@0 | 38 | this.invoke = function focusAnchor_invoke() |
michael@0 | 39 | { |
michael@0 | 40 | this.linkNode.focus(); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | this.check = function focusAnchor_check(aEvent) |
michael@0 | 44 | { |
michael@0 | 45 | todo_is(this.link, aEvent.accessible, |
michael@0 | 46 | "Focus should be fired against new link accessible!"); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | this.getID = function focusAnchor_getID() |
michael@0 | 50 | { |
michael@0 | 51 | return "focus a:focus{overflow:scroll} #1"; |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function tabAnchor(aID) |
michael@0 | 56 | { |
michael@0 | 57 | this.linkNode = getNode(aID); |
michael@0 | 58 | this.link = getAccessible(this.linkNode); |
michael@0 | 59 | |
michael@0 | 60 | this.eventSeq = [ |
michael@0 | 61 | new invokerChecker(EVENT_FOCUS, getAccessible, this.linkNode) |
michael@0 | 62 | ]; |
michael@0 | 63 | |
michael@0 | 64 | this.invoke = function tabAnchor_invoke() |
michael@0 | 65 | { |
michael@0 | 66 | synthesizeKey("VK_TAB", { shiftKey: false }); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | this.check = function tabAnchor_check(aEvent) |
michael@0 | 70 | { |
michael@0 | 71 | todo_is(this.link, aEvent.accessible, |
michael@0 | 72 | "Focus should be fired against new link accessible!"); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | this.getID = function tabAnchor_getID() |
michael@0 | 76 | { |
michael@0 | 77 | return "focus a:focus{overflow:scroll} #2"; |
michael@0 | 78 | } |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | //////////////////////////////////////////////////////////////////////////// |
michael@0 | 82 | // Do tests |
michael@0 | 83 | |
michael@0 | 84 | var gQueue = null; |
michael@0 | 85 | //gA11yEventDumpID = "eventdump"; // debug stuff |
michael@0 | 86 | //gA11yEventDumpToConsole = true; |
michael@0 | 87 | |
michael@0 | 88 | function doTests() |
michael@0 | 89 | { |
michael@0 | 90 | // Shift+Tab not working, and a test timeout, bug 746977 |
michael@0 | 91 | if (MAC) { |
michael@0 | 92 | todo(false, "Shift+tab isn't working on OS X, needs to be disabled until bug 746977 is fixed!"); |
michael@0 | 93 | SimpleTest.finish(); |
michael@0 | 94 | return; |
michael@0 | 95 | } |
michael@0 | 96 | |
michael@0 | 97 | gQueue = new eventQueue(); |
michael@0 | 98 | |
michael@0 | 99 | // CSS 'overflow: scroll' property setting and unsetting causes accessible |
michael@0 | 100 | // recreation (and fire show/hide events). For example, the focus and |
michael@0 | 101 | // blur of HTML:a with ':focus {overflow: scroll; }' CSS style causes its |
michael@0 | 102 | // accessible recreation. The focus event should be fired on new |
michael@0 | 103 | // accessible. |
michael@0 | 104 | gQueue.push(new focusAnchor("a")); |
michael@0 | 105 | gQueue.push(new tabAnchor("a2")); |
michael@0 | 106 | |
michael@0 | 107 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 108 | } |
michael@0 | 109 | |
michael@0 | 110 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 111 | addA11yLoadEvent(doTests); |
michael@0 | 112 | </script> |
michael@0 | 113 | </head> |
michael@0 | 114 | |
michael@0 | 115 | <body> |
michael@0 | 116 | |
michael@0 | 117 | <a target="_blank" |
michael@0 | 118 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=591163" |
michael@0 | 119 | title="mochitest for bug 413777: focus the a:focus {overflow: scroll;} shouldn't recreate HTML a accessible"> |
michael@0 | 120 | Mozilla Bug 591163 |
michael@0 | 121 | </a><br> |
michael@0 | 122 | <a target="_blank" |
michael@0 | 123 | title="Rework accessible tree update code" |
michael@0 | 124 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=570275"> |
michael@0 | 125 | Mozilla Bug 570275 |
michael@0 | 126 | </a><br> |
michael@0 | 127 | <a target="_blank" |
michael@0 | 128 | title="Text control frames should accept dynamic changes to the CSS overflow property" |
michael@0 | 129 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=686247"> |
michael@0 | 130 | Mozilla Bug 686247 |
michael@0 | 131 | </a><br> |
michael@0 | 132 | |
michael@0 | 133 | <p id="display"></p> |
michael@0 | 134 | <div id="content" style="display: none"></div> |
michael@0 | 135 | <pre id="test"> |
michael@0 | 136 | </pre> |
michael@0 | 137 | <div id="eventdump"></div> |
michael@0 | 138 | |
michael@0 | 139 | <div> |
michael@0 | 140 | <a id="a" class="link" href="www">link</a> |
michael@0 | 141 | </div> |
michael@0 | 142 | <div> |
michael@0 | 143 | <a id="a2" class="link" href="www">link2</a> |
michael@0 | 144 | </div> |
michael@0 | 145 | </body> |
michael@0 | 146 | </html> |