<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            height: 2000px;
            width: 200%;
        }
    </style>
    <script src="../../../resources/js-test-pre.js"></script>
    <script src="../../../resources/ui-helper.js"></script>
    <script>
        var jsTestIsAsync = true;
        
        async function testEventSequence()
        {
            const wheelEventSquence = {
                "events" : [
                    {
                        type : "wheel",
                        viewX : 100,
                        viewY : 100,
                        deltaY : -10,
                        phase : "began"
                    },
                    {
                        type : "wheel",
                        deltaY : -100,
                        phase : "changed"
                    },
                    {
                        type : "wheel",
                        phase : "ended"
                    },
                    {
                        type : "wheel",
                        deltaY : -100,
                        momentumPhase : "began"
                    },
                    {
                        type: "wheel",
                        deltaY: -80,
                        momentumPhase: "changed"
                    },
                    {
                        type : "wheel",
                        momentumPhase : "ended"
                    }
                ]
            };

            await UIHelper.mouseWheelSequence(wheelEventSquence);
            // Make sure we scrolled some non-trivial amount.
            shouldBeTrue('window.scrollY > 150');
        }

        async function scrollTest()
        {
            await testEventSequence();
            finishJSTest();
        }

        window.addEventListener('load', () => {
            setTimeout(scrollTest, 0);
        }, false);
    </script>
</head>
<body>
    <script src="../../../resources/js-test-post.js"></script>
</body>
</html>
