blob: 29c9c13844c721c213fe4e9deed9cb4be76abfdd [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.js"></script>
</head>
<body>
<div id="test-container">
<input type="text" id="input" value="Text">
<button onclick="checkResultAndNotifyDone()">Check Result</button>
</div>
<script>
window.jsTestIsAsync = true;
description("Tests that pressing the forward delete key in an editable element deletes the next character. To run this test manually, press the forward delete key and then click Check Result.");
runTest();
async function runTest()
{
let inputElement = document.getElementById("input");
if (!window.testRunner) {
inputElement.focus();
inputElement.setSelectionRange(0, 0);
return;
}
inputElement.addEventListener("keyup", checkResultAndNotifyDone, {once: true});
await UIHelper.activateFormControl(inputElement);
inputElement.setSelectionRange(0, 0);
await UIHelper.typeCharacter("forwardDelete");
}
function checkResultAndNotifyDone(keyEvent)
{
console.assert(keyEvent.key === "Delete");
shouldBeEqualToString('document.getElementById("input").value', "ext");
document.body.removeChild(document.getElementById("test-container"));
finishJSTest();
}
</script>
</body>
</html>