| OLD | NEW |
| 1 <p>This tests that option-tab moves you from a text field to a link, but plain o
ld tab does not.</p> | 1 <p>This tests that option-tab moves you from a text field to a link, but plain o
ld tab does not.</p> |
| 2 <p>Note: Option is the Mac name for what other platforms call Alt.</p> | 2 <p>Note: Option is the Mac name for what other platforms call Alt.</p> |
| 3 <input id="textField" type=text> <a onfocus="window.linkFocused = true" href="ht
tp://www.apple.com">link</a> | 3 <input id="textField" type=text> <a onfocus="window.linkFocused = true" href="ht
tp://www.apple.com">link</a> |
| 4 <input id="searchField" type=search> <a onfocus="window.linkFocused = true" href
="http://www.apple.com">link</a> | 4 <input id="searchField" type=search> <a onfocus="window.linkFocused = true" href
="http://www.apple.com">link</a> |
| 5 <pre id="console"> | 5 <pre id="console"> |
| 6 </pre> | 6 </pre> |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 if (window.testRunner) | 9 if (window.testRunner) |
| 10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
| 11 | 11 |
| 12 function test(fieldId) | 12 function test(fieldId) |
| 13 { | 13 { |
| 14 window.linkFocused = false; | 14 window.linkFocused = false; |
| 15 document.getElementById(fieldId).focus(); | 15 document.getElementById(fieldId).focus(); |
| 16 | 16 var event = document.createEvent("KeyboardEvents"); |
| 17 if (window.eventSender) | 17 event.initKeyboardEvent("keydown", true, true, document.defaultView, "U+0009
", 0, false, true, false, false, false); |
| 18 eventSender.keyDown('\u0009', ["altKey"]); | 18 document.getElementById(fieldId).dispatchEvent(event); |
| 19 | |
| 20 if (window.linkFocused) | 19 if (window.linkFocused) |
| 21 document.getElementById("console").innerHTML += "SUCCESS: Option-tab did
tab to the link (" + fieldId + ").\n"; | 20 document.getElementById("console").innerHTML += "SUCCESS: Option-tab did
tab to the link (" + fieldId + ").\n"; |
| 22 else | 21 else |
| 23 document.getElementById("console").innerHTML += "FAIL: Option-tab did no
t tab to the link (" + fieldId + ").\n"; | 22 document.getElementById("console").innerHTML += "FAIL: Option-tab did no
t tab to the link (" + fieldId + ").\n"; |
| 24 | 23 |
| 25 window.linkFocused = false; | 24 window.linkFocused = false; |
| 26 document.getElementById(fieldId).focus(); | 25 document.getElementById(fieldId).focus(); |
| 27 | 26 event = document.createEvent("KeyboardEvents"); |
| 28 if (window.eventSender) | 27 event.initKeyboardEvent("keydown", true, true, document.defaultView, "U+0009
", 0, false, false, false, false, false); |
| 29 eventSender.keyDown('\u0009', []); | 28 document.getElementById(fieldId).dispatchEvent(event); |
| 30 | |
| 31 if (window.linkFocused) | 29 if (window.linkFocused) |
| 32 document.getElementById("console").innerHTML += "FAIL: Plain old tab did
tab to the link (" + fieldId + ").\n"; | 30 document.getElementById("console").innerHTML += "FAIL: Plain old tab did
tab to the link (" + fieldId + ").\n"; |
| 33 else | 31 else |
| 34 document.getElementById("console").innerHTML += "SUCCESS: Plain old tab
did not tab to the link (" + fieldId + ").\n"; | 32 document.getElementById("console").innerHTML += "SUCCESS: Plain old tab
did not tab to the link (" + fieldId + ").\n"; |
| 35 } | 33 } |
| 36 | 34 |
| 37 test("textField"); | 35 test("textField"); |
| 38 test("searchField"); | 36 test("searchField"); |
| 39 | 37 |
| 40 </script> | 38 </script> |
| OLD | NEW |