haikuwebkit/LayoutTests/fast/forms/ios/suppress-software-keyboard-...

64 lines
1.8 KiB
HTML

<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<script src="../../../resources/ui-helper.js"></script>
<script src="../../../resources/js-test.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body {
margin: 0;
width: 100%;
height: 100%;
}
input {
width: 100%;
font-size: 100px;
display: block;
}
</style>
</head>
<body>
<input></input>
<div id="description"></div>
<div id="console"></div>
<script>
description("This test verifies that temporarily suppressing the software keyboard while focusing an input field does not crash the UI process. This test requires WebKitTestRunner.");
jsTestIsAsync = true;
addEventListener("load", async () => {
if (!window.testRunner)
return;
await UIHelper.setHardwareKeyboardAttached(false);
let input = document.querySelector("input");
const x = input.offsetLeft + input.offsetWidth / 2;
const y = input.offsetTop + input.offsetHeight / 2;
await new Promise(resolve => {
testRunner.runUIScript(`
(function() {
uiController.willStartInputSessionCallback = () => {
uiController.suppressSoftwareKeyboard = true;
uiController.suppressSoftwareKeyboard = false;
};
uiController.didShowKeyboardCallback = () => {
uiController.didShowKeyboardCallback = null;
uiController.willStartInputSessionCallback = null;
uiController.uiScriptComplete();
};
uiController.singleTapAtPoint(${x}, ${y}, () => { });
})()`, resolve);
});
input.blur();
await UIHelper.waitForKeyboardToHide();
finishJSTest();
});
</script>
</body>
</html>