<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.js"></script>
</head>
<body onload="runTest()">
<div><input id="input-keyboard" inputmode="text"></div>
<div><input id="input-nokeyboard" inputmode="none"></div>
<pre id="description"></pre>
<pre id="console"></pre>
<script>
jsTestIsAsync = true;

async function runTest() {
    await UIHelper.setHardwareKeyboardAttached(false);
    inputWithSystemKeyboard = document.getElementById("input-keyboard");
    inputWithoutSystemKeyboard = document.getElementById("input-nokeyboard");

    description("This test verifies that the system keyboard is not visible when tapping on an input field with inputmode=none.");

    debug("\nACTIVATE input with inputmode=text");
    await UIHelper.activateElementAndWaitForInputSession(inputWithSystemKeyboard);
    systemKeyboardRect = await UIHelper.inputViewBounds();
    shouldBe("systemKeyboardRect.height > 0", "true");
    await UIHelper.enterText("Text");
    shouldBe("inputWithSystemKeyboard.value", "'Text'");

    debug("\nACTIVATE input with inputmode=none");
    await UIHelper.activateElement(inputWithoutSystemKeyboard);
    await UIHelper.waitForKeyboardToHide();
    testPassed("Successfully dismissed keyboard");

    debug("\nTEST enter text in input with inputmode=none");
    await UIHelper.enterText("None");
    shouldBe("inputWithoutSystemKeyboard.value", "'None'");

    debug("\nTEST selection in input with inputmode=none");
    inputWithoutSystemKeyboard.select();

    selectionRects = [];
    while (!selectionRects.length)
        selectionRects = await UIHelper.getUISelectionViewRects();

    shouldBe("selectionRects.length", "1");
    shouldBe("selectionRects[0].left", "16");
    shouldBe("selectionRects[0].top", "38");
    shouldBe("selectionRects[0].width", "27");
    shouldBe("selectionRects[0].height", "15");
    finishJSTest();
}
</script>
</body>
</html>
