summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html
blob: b32b60611dad6d2eed66172c1f4b849c7e0e1be0 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<style>

#container {
  width: 200px;
  height: 200px;
  overflow: scroll;
}

#content {
  width: 750px;
  height: 10000px;
  background-color: blue;
}

</style>
<script src="../../resources/js-test.js"></script>
<div id="container">
  <div id="content"></div>
</div>
<div id="console"></div>
<script>

jsTestIsAsync = true;
element = document.getElementById("container");

var prevScrollTop;
var scrollStart;

function runTest() {
    internals.settings.setScrollAnimatorEnabled(true);

    element.addEventListener("scroll", onElementScroll);

    testRunner.layoutAndPaintAsyncThen(function() {
        // Give the container focus.
        eventSender.mouseMoveTo(100, 100);
        eventSender.mouseDown();
        eventSender.mouseUp();

        eventSender.keyDown('end');
    });
}

function onElementScroll() {
    if (prevScrollTop === undefined) {
        shouldNotBe("element.scrollTop",
                    "element.scrollHeight - element.clientHeight");
        shouldBeGreaterThan("element.scrollTop", "0");
        prevScrollTop = element.scrollTop;
    } else {
        shouldBeGreaterThan("element.scrollTop", "prevScrollTop");
        finishJSTest();
    }
}

description("Tests that overflow scrolls are animated.");

if (window.eventSender)
    runTest();
else
    debug("FAIL: This test requires window.eventSender.");

</script>