<!DOCTYPE html>
<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>
    <input id="text" type="text">
    <input id="date" type="date" value="2020-10-07">
    <script>
    jsTestIsAsync = true;

    textInput = document.getElementById("text");
    dateInput = document.getElementById("date");

    addEventListener("load", async () => {
        description("This test verifies that focusing an element that presents a keyboard, and then focusing an element which dismisses the keyboard, does not change the scrollable area.");

        await UIHelper.setHardwareKeyboardAttached(false);

        await UIHelper.activateElementAndWaitForInputSession(text);
        await UIHelper.activateElementAndWaitForInputSession(date);

        await UIHelper.waitForKeyboardToHide();
        document.activeElement.blur();

        await UIHelper.dragFromPointToPoint(160, 150, 160, 50, 0.1);
        await UIHelper.ensureStablePresentationUpdate();
        shouldBeEqualToNumber("document.scrollingElement.scrollTop", 0);

        finishJSTest();
    });
    </script>
</body>
</html>
