<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            height: 5000px;
        }
    </style>
    <script src="../../../resources/js-test-pre.js"></script>
    <script src="../../../resources/ui-helper.js"></script>
    <script>
        var jsTestIsAsync = true;

        let windowScrollEventCount = 0;
        let defaultPrevented;

        async function testScroll()
        {
            await UIHelper.mouseWheelScrollAt(100, 100);
            shouldBe('windowScrollEventCount', '0');
            shouldBeTrue('defaultPrevented');
            finishJSTest();
        }

        window.addEventListener('load', () => {
            debug('Tests that an active wheel event handler on the window remains active.')
            window.addEventListener('wheel', (event) => {
                event.preventDefault();
                defaultPrevented = event.defaultPrevented;
            }, { passive: false });

            window.addEventListener('scroll', () => {
                ++windowScrollEventCount;
            }, false);

            setTimeout(testScroll, 0);
        }, false);
    </script>
</head>
<body>
    <script src="../../../resources/js-test-post.js"></script>
</body>
</html>
