Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(956)

Side by Side Diff: LayoutTests/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html

Issue 850443002: Scroll Customization Prototype (Not for review, WIP) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase / cleanup / minor bug fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>ScrollState constructor behaves correctly</title>
6 <script src="../../../resources/testharness.js"></script>
7 <script src="../../../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10 <script>
11
12 if (!window.internals || !window.internals.runtimeFlags.scrollCustomizationEnabl ed) {
13 console.log("These tests only work with window.internals exposed, " +
14 "and require scroll customization.");
15 done();
16 }
17
18 var elementCount = 10;
19 var remainingNumberOfTimesToBeCalled = elementCount;
20
21 var distributeScroll = function(scrollState) {
22 this.calledOrder = elementCount - remainingNumberOfTimesToBeCalled;
23 remainingNumberOfTimesToBeCalled--;
24 scrollState.distributeToScrollChainDescendant();
25 }
26
27 var elements = [];
28 for (var i = 0; i < elementCount; ++i) {
29 var element = document.createElement("div");
30 element.creationOrder = i;
31 element.distributeScroll = distributeScroll;
32 elements.push(element);
33 }
34
35 test(function() {
36 var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
37 window.internals.setScrollChain(scrollState, elements);
38 scrollState.distributeToScrollChainDescendant();
39 assert_equals(0, remainingNumberOfTimesToBeCalled);
40 for (var i = 0; i < elementCount; ++i)
41 assert_equals(elements[i].creationOrder, elements[i].calledOrder);
42 }, "distributeToScrollChainDescendant propagates correctly.");
43
44 test(function() {
45 var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
46 window.internals.setScrollChain(scrollState, []);
47 assert_equals(0, remainingNumberOfTimesToBeCalled);
48 scrollState.distributeToScrollChainDescendant();
49 assert_equals(0, remainingNumberOfTimesToBeCalled);
50 }, "distributeToScrollChainDescendant with empty scroll chain does nothing.");
51
52 </script>
53 </body>
54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698