<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/ui-helper.js"></script>
<style>
.hidden {
    display: none;
}
</style>
</head>

<body>
<p id="description"></p>
<p id="manual-instructions" class="hide">To run this test by hand, press a modifier key.</p>
<div id="console"></div>
<script>
window.jsTestIsAsync = true;

async function fireKeyDownEventsWithModifiers() {
    for (const modifierKey of ['metaKey', 'altKey', 'shiftKey', 'ctrlKey']) {
        await UIHelper.keyDown("k", [modifierKey]);
        debug('Dispatched KeyDown event with modifier ' + modifierKey);
    }
}

async function runTest()
{
    if (!window.testRunner)
        document.getElementById("manual-instructions").classList.remove("hidden");

    window.addEventListener('mousemove', () => testFailed("MouseMove event detected"));

    if (window.testRunner)
        await fireKeyDownEventsWithModifiers();
    finishJSTest();
}

description("This test verifies that MouseMove events are not fired when modifier keys are pressed.");
runTest();
</script>
</body>
</html>
