<!DOCTYPE html>
<html>
<head>
    <script src="../../../../resources/js-test-pre.js"></script>
    <script src="../../../../resources/ui-helper.js"></script>
    <style>
        body {
            margin: none;
        }
    </style>
    <meta name="viewport" content="initial-scale=1">
</head>
<body>
    <p id="description"></p>
    <div id="console">
    </div>
    <script>
        description("Test that a tap is registered as a pointerdown then pointerup.");
        window.jsTestIsAsync = true;

        function runTest()
        {
            // FIXME: At the moment a touch listener is required due
            // to the way pointer events are dispatched.
            // https://bugs.webkit.org/show_bug.cgi?id=191333
            window.addEventListener("touchstart", (event) => {
                debug("Remove this when bug 19133 is fixed.");
            });

            window.addEventListener("pointerdown", (event) => {
                debug("pointerdown fired.");
            });

            window.addEventListener("pointerup", (event) => {
                debug("pointerup fired.");
                finishJSTest();
            });

            UIHelper.tapAt(50, 200);
        }

        window.addEventListener("load", runTest, false);
    </script>
    <script src="../../../../resources/js-test-post.js"></script>
</body>
</html>
