file_synthmousemove.html (1227B)
1 <script src="/tests/SimpleTest/SimpleTest.js"></script> 2 <script src="/tests/SimpleTest/EventUtils.js"></script> 3 <style> 4 .spacer { 5 height: 50px; 6 } 7 .special { 8 height: 200px; 9 background-color: blue; 10 } 11 .special:hover { 12 background-color: red; 13 } 14 </style> 15 <div id="x" class="spacer"></div> 16 <div id="x2" class="special"></div> 17 <div style="margin-top: 100vh"> 18 <!-- this is here so it wrongly gets sent the events --> 19 <iframe src="https://example.com/tests/layout/base/tests/helper_synthmousemove.html"></iframe> 20 </div> 21 <div style="height: 300vh"></div> 22 <script> 23 24 async function runTest() { 25 let thex = document.getElementById("x"); 26 let thex2 = document.getElementById("x2") 27 synthesizeMouse(thex, 20, 20, {type: "mousemove"}); 28 opener.is( 29 getComputedStyle(thex2).backgroundColor, 30 "rgb(0, 0, 255)", 31 "Part is blue" 32 ); 33 34 thex.remove(); 35 document.documentElement.getBoundingClientRect(); 36 await new Promise(r => requestAnimationFrame(r)); 37 await new Promise(r => requestAnimationFrame(r)); 38 opener.is( 39 getComputedStyle(thex2).backgroundColor, 40 "rgb(255, 0, 0)", 41 "Part is red" 42 ); 43 44 opener.reportSuccess(); 45 window.close(); 46 } 47 48 SimpleTest.waitForFocus(runTest); 49 </script>