test_select_reframe.html (1432B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Test for page up/down in collapsed select (bug 1488828)</title> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <script src="/tests/SimpleTest/EventUtils.js"></script> 6 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 7 <style> 8 .reframe { 9 display: flex; 10 } 11 </style> 12 <div id="container"> 13 <select> 14 <option>ABC</option> 15 <option>DEF</option> 16 </select> 17 </div> 18 <script> 19 (async function() { 20 SimpleTest.waitForExplicitFinish(); 21 22 const utils = SpecialPowers.DOMWindowUtils; 23 const select = document.querySelector("select"); 24 await SimpleTest.promiseFocus(window); 25 26 ok(!select.openInParentProcess, "Should not be open") 27 28 select.focus(); 29 synthesizeKey("VK_SPACE"); 30 31 ok(SpecialPowers.wrap(select).openInParentProcess, "Should open"); 32 33 const container = document.getElementById("container"); 34 container.getBoundingClientRect(); // flush layout 35 36 const frameCountBeforeReframe = utils.framesConstructed; 37 38 container.classList.add("reframe"); 39 40 container.getBoundingClientRect(); // flush layout 41 42 ok(utils.framesConstructed > frameCountBeforeReframe, "Should have reframed"); 43 ok(SpecialPowers.wrap(select).openInParentProcess, "Should remain open"); 44 45 select.remove(); 46 47 container.getBoundingClientRect(); // flush layout 48 ok(!SpecialPowers.wrap(select).openInParentProcess, "Should close after removal"); 49 50 SimpleTest.finish(); 51 }()); 52 </script>