tor-browser

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

scroll-back-to-initial-position.html (1565B)


      1 <!DOCTYPE html>
      2 <title>Scroll back to initial position</title>
      3 <meta name="timeout" content="long">
      4 <link rel="author" title="Yupei Wang" href="mailto:perryuwang@tencent.com">
      5 <link rel="help" href="https://drafts.csswg.org/cssom-view/#smooth-scrolling">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script src="support/scroll-behavior.js"></script>
      9 <style>
     10  .filler { height: 1000px }
     11 
     12  #scrollable {
     13    overflow: scroll;
     14    width: 100px;
     15    height: 100px;
     16  }
     17 </style>
     18 <div id="log"></div>
     19 <div id="testContainer">
     20  <div id="scrollable">
     21    <div class="filler"></div>
     22  </div>
     23 </div>
     24 <script>
     25  promise_test(() => {
     26    resetScroll(scrollable);
     27    assert_equals(scrollable.scrollTop, 0, "Inital value of scrollTop");
     28    scrollNode(scrollable, "scroll", "smooth", 0, 500);
     29    scrollNode(scrollable, "scroll", "smooth", 0, 0);
     30    return waitForScrollEnd(scrollable).then(() => {
     31      assert_equals(scrollable.scrollTop, 0, "Final value of scrollTop");
     32    });
     33  }, "Element should scroll back to initial position with smooth behavior");
     34 
     35  promise_test(() => {
     36    resetScroll(scrollable);
     37    assert_equals(scrollable.scrollTop, 0, "Inital value of scrollTop");
     38    scrollNode(scrollable, "scroll", "smooth", 0, 500);
     39    scrollNode(scrollable, "scroll", "auto", 0, 0);
     40    return waitForScrollEnd(scrollable).then(() => {
     41      assert_equals(scrollable.scrollTop, 0, "Final value of scrollTop");
     42    });
     43  }, "Element should scroll back to initial position with auto behavior");
     44 </script>