4 <title>ScrollState consumeDelta
</title>
5 <script src=
"../../../resources/testharness.js"></script>
6 <script src=
"../../../resources/testharnessreport.js"></script>
11 function deltaShouldBe(scrollState
, x
, y
, testName
) {
13 assert_equals(scrollState
.deltaX
, x
);
14 assert_equals(scrollState
.deltaY
, y
);
19 assert_true('ScrollState' in window
, "'ScrollState' in window");
20 }, "These tests only work with scroll customization enabled.");
22 if ('ScrollState' in window
) {
23 var scrollState
= new ScrollState(10, -20);
24 deltaShouldBe(scrollState
, 10, -20, "Unconsumed deltas");
25 scrollState
.consumeDelta(2, -3);
26 deltaShouldBe(scrollState
, 8, -17, "Partially consumed deltas");
27 scrollState
.consumeDelta(8, -17);
28 deltaShouldBe(scrollState
, 0, 0, "Fully consumed deltas");