| <meta name="viewport" content="width=device-width"> |
| <script src="../../../resources/ui-helper.js"></script> |
| testRunner.waitUntilDone(); |
| <p>This tests that DOM keyup events are dispatched on iOS for hardware key presses. To run this test manually, focus the text field below and then verify that a message is emitted when you press the following keys: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, `, ~, !, @, #, $, %, ^, &, *, (, ), -, _, =, +, [, ], {, }, \, |, ;, :, ', ", ,, <, ., >, /, ?, <return>.</p> |
| <input type="text" id="input" onkeyup="logKeyEvent(event)"> |
| const asciiCharactersToType = "abcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()-_=+[]{}\\|;:'\",<.>/?\r"; |
| var numberOfFiredKeyEventsForTestComplete; |
| var numberOfFiredKeyEvents = 0; |
| document.getElementById("console").appendChild(document.createTextNode(message + "\n")); |
| function logKeyEvent(event) |
| // Ignore Shift keyups, if they are dispatched, as not all versions of iOS dispatch them. |
| if (event.key == "Shift") |
| ++numberOfFiredKeyEventsForTestComplete; |
| if (event.key !== "Shift") { |
| for (let propertyName of ["type", "key", "code", "keyIdentifier", "keyCode", "charCode", "keyCode", "which"]) |
| pieces.push(`${propertyName}: ${event[propertyName]}`); |
| if (++numberOfFiredKeyEvents >= numberOfFiredKeyEventsForTestComplete && window.testRunner) |
| let charactersToType = asciiCharactersToType.split(""); |
| numberOfFiredKeyEventsForTestComplete = charactersToType.length; |
| let input = document.getElementById("input"); |
| await UIHelper.activateFormControl(input); |
| for (let character of charactersToType) |
| await UIHelper.typeCharacter(character); |