Index: LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html |
diff --git a/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html b/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ec328003a093aec3ab6c97680eb0ffc6811ce9e5 |
--- /dev/null |
+++ b/LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html |
@@ -0,0 +1,32 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<title>ScrollState consumeDelta</title> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+<script> |
+ |
+if (!window.internals || !window.internals.runtimeFlags.scrollCustomizationEnabled) { |
+ console.log("These tests only work with window.internals exposed, " + |
+ "and require scroll customization."); |
+ done(); |
+} |
+ |
+function deltaShouldBe(scrollState, x, y, testName) { |
+ test(function() { |
+ assert_equals(scrollState.deltaX, x); |
+ assert_equals(scrollState.deltaY, y); |
+ }, testName); |
+} |
+ |
+var scrollState = new ScrollState(10, -20); |
+deltaShouldBe(scrollState, 10, -20, "Unconsumed deltas"); |
+scrollState.consumeDelta(2, -3); |
+deltaShouldBe(scrollState, 8, -17, "Partially consumed deltas"); |
+scrollState.consumeDelta(8, -17); |
+deltaShouldBe(scrollState, 0, 0, "Fully consumed deltas"); |
+</script> |
+</body> |
+</html> |