summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-viewport/zoom/scroll-top-test-with-zoom.html
blob: 9656fe120e8ec39a7570950b4b1ad39d6c2fb16b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!doctype html>
<title>Scroll Top Test with Zoom</title>
<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  #container {
    width: 200px;
    height: 100px;
    border: solid thick;
    overflow: auto;
  }
</style>
<div id="container">
  <div style="width: 100px; height: 2000px"></div>
</div>

<script>
  var container = document.getElementById('container');
  container.scrollTop = 77;
  test(function() {
    assert_equals(container.scrollTop, 77, "Initial scrollTop should be 77");
  }, "Initial scrollTop with no zoom");

  document.body.style.zoom = 1.2;
  document.body.offsetTop;

  document.body.style.zoom = 1;
  test(function() {
    assert_equals(container.scrollTop, 77, "scrollTop should remain consistent after resetting zoom");
  }, "scrollTop after resetting zoom");
  done();
</script>