test_bug1045270.html (1333B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1045270 5 --> 6 <head> 7 <title>Test for Bug 583514</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1045270">Mozilla Bug 1045270</a> 14 <p id="display"></p> 15 <div id="content"> 16 <input type=number> 17 </div> 18 <pre id="test"> 19 <script type="application/javascript"> 20 21 /** Test for Bug 1045270 */ 22 23 var input = document.querySelector("input"); 24 SimpleTest.waitForExplicitFinish(); 25 SimpleTest.waitForFocus(function() { 26 input.focus(); 27 input.addEventListener("input", function() { 28 // reframe 29 document.body.style.display = "none"; 30 document.body.style.display = ""; 31 document.body.offsetLeft; // flush 32 }); 33 sendString("1"); 34 SimpleTest.executeSoon(function() { 35 sendString("2"); 36 SimpleTest.executeSoon(function() { 37 is(input.value, "12", "Reframe should restore focus and selection properly"); 38 SimpleTest.finish(); 39 }); 40 }); 41 }); 42 43 </script> 44 </pre> 45 </body> 46 </html>