scrollbar-events.html (1566B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1866773"> 5 <style> 6 #container { 7 width: 100px; 8 height: 100px; 9 border: 1px; 10 } 11 #child { 12 height: 200px; 13 } 14 </style> 15 <div id="container"> 16 <div id="child"></div> 17 </div> 18 <script> 19 let container = document.getElementById("container"); 20 let child = document.getElementById("child"); 21 let InspectorUtils = SpecialPowers.wrap(window).InspectorUtils; 22 const kDuration = 200; 23 24 promise_test(async function(t) { 25 await SpecialPowers.pushPrefEnv({ 26 set: [ 27 ["ui.useOverlayScrollbars", 1], 28 ["ui.scrollbarFadeDuration", kDuration], 29 ] 30 }); 31 32 for (let type of ["transitionstart", "transitionend"]) { 33 container.addEventListener(type, t.unreached_func(`Shouldn't see ${type} event on #container`)); 34 } 35 // This creates scrollbars and triggers activation. 36 container.style.overflow = "scroll"; 37 container.getBoundingClientRect(); 38 let scrollbars = InspectorUtils.getChildrenForNode(container, true, true).filter(child => SpecialPowers.wrap(child).nodeName.toLowerCase() == "scrollbar"); 39 assert_equals(scrollbars.length, 2, "Should have two scrollbars"); 40 await new Promise(r => t.step_timeout(r, kDuration)); 41 await new Promise(r => requestAnimationFrame(r)); 42 assert_true(true, "No scrollbar event should've happened by now"); 43 // FIXME: This doesn't seem to be done automatically by the test harness in WPT 44 await SpecialPowers.popPrefEnv(); 45 }); 46 </script>