| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="../../../resources/ui-helper.js"></script> |
| </head> |
| <body> |
| <div id="test-container"> |
| <textarea id="input"></textarea> |
| <textarea id="output" readonly></textarea> |
| </div> |
| <script> |
| window.jsTestIsAsync = true; |
| |
| let input = document.getElementById("input"); |
| |
| function appendANewline() |
| { |
| let outputElement = document.getElementById("output"); |
| outputElement.value = outputElement.value + "\n"; |
| } |
| |
| async function runTest() |
| { |
| if (window.testRunner) |
| await UIHelper.setHardwareKeyboardAttached(false); |
| |
| await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.activateElement(input), input, "focus"); |
| |
| await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("w"), input, "input"); |
| shouldBeEqualToString('document.getElementById("input").value', "w"); |
| |
| await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("\b"), input, "input"); |
| shouldBeEqualToString('document.getElementById("input").value', ""); |
| |
| document.body.removeChild(document.getElementById("test-container")); |
| finishJSTest(); |
| } |
| |
| description("This tests using the software keyboard and pressing 'w' then <kbd>backspace</kbd> deletes the 'w' and does not cause an assertion failure in a debug build.") |
| input.addEventListener("keydown", appendANewline); |
| |
| runTest(); |
| </script> |
| </body> |
| </html> |