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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/static-viewport-control.js

Issue 2592483002: [DevTools] Move console viewport to console, rename StaticViewportControl. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/static-viewport-control-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 TestRunner.addResult("This tests if the StaticViewportControl works properly.");
2
3 var items = [];
4 var heights = [];
5 for (var i = 0; i < 100; i++){
6 items[i] = document.createElement("div");
7 items[i].style.height = (heights[i] = (i % 4) ? 50 : 28) + "px";
8 items[i].textContent = i;
9 }
10 var viewport = new UI.StaticViewportControl({
11 fastItemHeight: i => heights[i],
12 itemCount: _ => items.length,
13 itemElement: i => items[i]
14 });
15 viewport.element.style.height = "300px";
16 UI.inspectorView.element.appendChild(viewport.element);
17
18 viewport.refresh();
19 dumpViewport();
20
21 viewport.forceScrollItemToBeFirst(26);
22 dumpViewport();
23
24 viewport.scrollItemIntoView(33);
25 dumpViewport();
26
27 viewport.scrollItemIntoView(30);
28 dumpViewport();
29
30 viewport.forceScrollItemToBeFirst(30);
31 dumpViewport();
32
33 viewport.forceScrollItemToBeLast(88);
34 dumpViewport();
35
36 for (var i = 0; i < 100; i++)
37 items[i].style.height = (heights[i] = (i % 2) ? 55 : 63) + "px";
38 viewport.refresh();
39 viewport.forceScrollItemToBeLast(88);
40 dumpViewport();
41
42 TestRunner.completeTest();
43
44 function dumpViewport()
45 {
46 TestRunner.addResult("First:" + viewport.firstVisibleIndex());
47 TestRunner.addResult("Last:" + viewport.lastVisibleIndex());
48 TestRunner.addResult("Active Items:" + viewport._innerElement.children.lengt h);
49 TestRunner.addResult("");
50 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/static-viewport-control-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698