tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

scrollend-event-fires-to-iframe-window.html (2759B)


      1 <!DOCTYPE html>
      2 <html>
      3 
      4 <head>
      5  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1">
      6  <script src="/resources/testharness.js"></script>
      7  <script src="/resources/testharnessreport.js"></script>
      8  <script src="/resources/testdriver.js"></script>
      9  <script src="/resources/testdriver-actions.js"></script>
     10  <script src="/resources/testdriver-vendor.js"></script>
     11  <script src="scroll_support.js"></script>
     12  <script src="scrollend-user-scroll-common.js"></script>
     13  <style>
     14    iframe {
     15      height: 300px;
     16      width: 300px;
     17    }
     18  </style>
     19 </head>
     20 
     21 <body style="margin:0" onload=runTest()>
     22  <iframe id="frame" src="scrollend-event-fires-to-iframe-inner-frame.html"></iframe>
     23 </body>
     24 
     25 <script>
     26  function runTest() {
     27    let target_div = frame.contentDocument.getElementById("scroller");
     28    //Tests for scrollend events on an element within an iframe.
     29    promise_test(async (t) => {
     30      await test_scrollend_on_touch_drag(t, target_div);
     31    }, 'Tests that the target_div within iframe gets scrollend event when touch ' +
     32    'dragging.');
     33 
     34    promise_test(async (t) => {
     35      await test_scrollend_on_scrollbar_gutter_click(t, target_div);
     36    }, 'Tests that the target_div within iframe gets scrollend event when ' +
     37    'clicking scrollbar.');
     38 
     39    // Same issue as previous test.
     40    promise_test(async (t) => {
     41      await test_scrollend_on_scrollbar_thumb_drag(t, target_div);
     42    }, 'Tests that the target_div within iframe gets scrollend event when ' +
     43    'dragging the scrollbar thumb.');
     44 
     45    promise_test(async (t) => {
     46      await test_scrollend_on_mousewheel_scroll(t, target_div, frame);
     47    }, 'Tests that the target_div within iframe gets scrollend event when mouse ' +
     48    'wheel scrolling.');
     49 
     50    promise_test(async (t) => {
     51      await test_scrollend_on_keyboard_scroll(t, target_div);
     52    }, 'Tests that the target_div within iframe gets scrollend event when ' +
     53    'sending DOWN key to the target.');
     54 
     55    // Test for scrollend events on the iframe's window.
     56    // TODO: add similar tests with different input modes.
     57    promise_test(async (t) => {
     58      let scroller = frame.contentDocument.scrollingElement;
     59 
     60      await waitForScrollReset(t, scroller);
     61      await waitForCompositorReady();
     62 
     63      const targetScrollendPromise = waitForScrollendEventNoTimeout(frame.contentDocument);
     64      verifyNoScrollendOnDocument(t);
     65 
     66      let x = target_div.getBoundingClientRect().width + 20;
     67      let y = 20;
     68      let dy = 30;
     69      await new test_driver.Actions().scroll(x, y, 0, dy).send();
     70      await targetScrollendPromise;
     71      assert_equals(scroller.scrollTop, dy, 'window scrolled by mousewheel');
     72    }, 'scrollend fires to iframe window on mousewheelscroll');
     73  }
     74 
     75 </script>
     76 
     77 </html>