| OLD | NEW |
| 1 <p>This test tabs with different combinations of modifiers pressed, where some s
hould advance focus and some should not.</p> | 1 <p>This test tabs with different combinations of modifiers pressed, where some s
hould advance focus and some should not.</p> |
| 2 <div id="testDiv"></div> | 2 <div id="testDiv"></div> |
| 3 <pre id="console"></pre> | 3 <pre id="console"></pre> |
| 4 | 4 |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 if (window.testRunner) | 7 if (window.testRunner) |
| 8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
| 9 | 9 |
| 10 function log(s) | 10 function log(s) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 input = parentElement.ownerDocument.createElement('input'); | 51 input = parentElement.ownerDocument.createElement('input'); |
| 52 addEventListeners(input); | 52 addEventListeners(input); |
| 53 input.setAttribute("id", "b"); | 53 input.setAttribute("id", "b"); |
| 54 parentElement.appendChild(input); | 54 parentElement.appendChild(input); |
| 55 input = parentElement.ownerDocument.createElement('input'); | 55 input = parentElement.ownerDocument.createElement('input'); |
| 56 addEventListeners(input); | 56 addEventListeners(input); |
| 57 input.setAttribute("id", "c"); | 57 input.setAttribute("id", "c"); |
| 58 parentElement.appendChild(input); | 58 parentElement.appendChild(input); |
| 59 } | 59 } |
| 60 | 60 |
| 61 function dispatchTab(element, shiftKey, metaKey, ctrlKey, altGraphKey) | 61 function dispatchTab(element, shiftKey, metaKey, ctrlKey) |
| 62 { | 62 { |
| 63 var event = document.createEvent("KeyboardEvents"); | 63 var event = document.createEvent("KeyboardEvents"); |
| 64 var tabKeyIdentifier = "U+0009"; | 64 var tabKeyIdentifier = "U+0009"; |
| 65 event.initKeyboardEvent("keydown", true, true, document.defaultView, tabKeyI
dentifier, 0, ctrlKey, false, shiftKey, metaKey, altGraphKey); | 65 event.initKeyboardEvent("keydown", true, true, document.defaultView, tabKeyI
dentifier, 0, ctrlKey, false, shiftKey, metaKey); |
| 66 element.dispatchEvent(event); | 66 element.dispatchEvent(event); |
| 67 } | 67 } |
| 68 | 68 |
| 69 function setup() | 69 function setup() |
| 70 { | 70 { |
| 71 var testDiv = document.getElementById('testDiv'); | 71 var testDiv = document.getElementById('testDiv'); |
| 72 addElements(testDiv); | 72 addElements(testDiv); |
| 73 } | 73 } |
| 74 | 74 |
| 75 setup(); | 75 setup(); |
| 76 | 76 |
| 77 var middleInput = document.getElementsByTagName('input')[1]; | 77 var middleInput = document.getElementsByTagName('input')[1]; |
| 78 | 78 |
| 79 for (i = 0; i < 2; ++i) { | 79 for (i = 0; i < 2; ++i) { |
| 80 log("resetting focus to middle input\n"); | 80 log("resetting focus to middle input\n"); |
| 81 middleInput.focus(); | 81 middleInput.focus(); |
| 82 log("test tab case that should advance focus\n"); | 82 log("test tab case that should advance focus\n"); |
| 83 dispatchTab(middleInput, (i & 1) != 0, false, false, false); | 83 dispatchTab(middleInput, (i & 1) != 0, false, false); |
| 84 } | 84 } |
| 85 for (i = 2; i < 16; ++i) { | 85 for (i = 2; i < 8; ++i) { |
| 86 log("resetting focus to middle input\n"); | 86 log("resetting focus to middle input\n"); |
| 87 middleInput.focus(); | 87 middleInput.focus(); |
| 88 log("test tab case that should not advance focus\n"); | 88 log("test tab case that should not advance focus\n"); |
| 89 dispatchTab(middleInput, (i & 1) != 0, (i & 2) != 0, (i & 4) != 0, (i & 8) !
= 0); | 89 dispatchTab(middleInput, (i & 1) != 0, (i & 2) != 0, (i & 4) != 0); |
| 90 } | 90 } |
| 91 | 91 |
| 92 </script> | 92 </script> |
| OLD | NEW |