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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/list-control-fixed-height.js

Issue 2605253002: [DevTools] Add grow mode to ListControl. (Closed)
Patch Set: addressed review comments Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/list-control-fixed-height-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
1 TestRunner.addResult('Test ListControl rendering and selection for fixed height case.'); 1 TestRunner.addResult('Test ListControl rendering and selection for fixed height case.');
2 2
3 class Delegate { 3 class Delegate {
4 constructor() { 4 constructor() {
5 this.height = 10; 5 this.height = 10;
6 } 6 }
7 7
8 createElementForItem(item) { 8 createElementForItem(item) {
9 TestRunner.addResult('Creating element for ' + item); 9 TestRunner.addResult('Creating element for ' + item);
10 var element = document.createElement('div'); 10 var element = document.createElement('div');
(...skipping 13 matching lines...) Expand all
24 selectedItemChanged(from, to, fromElement, toElement) { 24 selectedItemChanged(from, to, fromElement, toElement) {
25 TestRunner.addResult('Selection changed from ' + from + ' to ' + to); 25 TestRunner.addResult('Selection changed from ' + from + ' to ' + to);
26 if (fromElement) 26 if (fromElement)
27 fromElement.classList.remove('selected'); 27 fromElement.classList.remove('selected');
28 if (toElement) 28 if (toElement)
29 toElement.classList.add('selected'); 29 toElement.classList.add('selected');
30 } 30 }
31 } 31 }
32 32
33 var delegate = new Delegate(); 33 var delegate = new Delegate();
34 var list = new UI.ListControl(delegate); 34 var list = new UI.ListControl(delegate, UI.ListMode.ViewportFixedItems);
35 list.setHeightMode(UI.ListHeightMode.Fixed);
36 list.element.style.height = '73px'; 35 list.element.style.height = '73px';
37 UI.inspectorView.element.appendChild(list.element); 36 UI.inspectorView.element.appendChild(list.element);
38 37
39 function dumpList() 38 function dumpList()
40 { 39 {
41 var height = list.element.offsetHeight; 40 var height = list.element.offsetHeight;
42 TestRunner.addResult(`----list[length=${list.length()}][height=${height}]----` ); 41 TestRunner.addResult(`----list[length=${list.length()}][height=${height}]----` );
43 for (var child of list.element.children) { 42 for (var child of list.element.children) {
44 var offsetTop = child.getBoundingClientRect().top - list.element.getBounding ClientRect().top; 43 var offsetTop = child.getBoundingClientRect().top - list.element.getBounding ClientRect().top;
45 var offsetBottom = child.getBoundingClientRect().bottom - list.element.getBo undingClientRect().top; 44 var offsetBottom = child.getBoundingClientRect().bottom - list.element.getBo undingClientRect().top;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 dumpList(); 129 dumpList();
131 130
132 TestRunner.addResult('Scrolling to 12'); 131 TestRunner.addResult('Scrolling to 12');
133 list.scrollItemAtIndexIntoView(12); 132 list.scrollItemAtIndexIntoView(12);
134 dumpList(); 133 dumpList();
135 134
136 TestRunner.addResult('Scrolling to 13'); 135 TestRunner.addResult('Scrolling to 13');
137 list.scrollItemAtIndexIntoView(13); 136 list.scrollItemAtIndexIntoView(13);
138 dumpList(); 137 dumpList();
139 138
140 TestRunner.addResult('Changing the item height, switching to measure'); 139 TestRunner.addResult('Changing the item height');
141 delegate.height = 15; 140 delegate.height = 15;
142 list.setHeightMode(UI.ListHeightMode.Measured); 141 list.fixedHeightChanged();
143 dumpList(); 142 dumpList();
144 143
145 TestRunner.addResult('Selecting 7'); 144 TestRunner.addResult('Selecting 7');
146 list.selectItemAtIndex(7); 145 list.selectItemAtIndex(7);
147 dumpList(); 146 dumpList();
148 147
149 TestRunner.addResult('Replacing 7 with 27'); 148 TestRunner.addResult('Replacing 7 with 27');
150 list.replaceItemsInRange(7, 8, [27]); 149 list.replaceItemsInRange(7, 8, [27]);
151 dumpList(); 150 dumpList();
152 151
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 191
193 TestRunner.addResult('Replacing all but 29 with []'); 192 TestRunner.addResult('Replacing all but 29 with []');
194 list.replaceItemsInRange(0, 29, []); 193 list.replaceItemsInRange(0, 29, []);
195 dumpList(); 194 dumpList();
196 195
197 TestRunner.addResult('ArrowDown'); 196 TestRunner.addResult('ArrowDown');
198 list.onKeyDown(TestRunner.createKeyEvent('ArrowDown')); 197 list.onKeyDown(TestRunner.createKeyEvent('ArrowDown'));
199 dumpList(); 198 dumpList();
200 199
201 TestRunner.completeTest(); 200 TestRunner.completeTest();
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/list-control-fixed-height-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698