OLD | NEW |
1 TestRunner.addResult('Test ListControl rendering for variable height case.'); | 1 TestRunner.addResult('Test ListControl rendering for variable height case.'); |
2 | 2 |
3 class Delegate { | 3 class Delegate { |
4 constructor() { | 4 constructor() { |
5 } | 5 } |
6 | 6 |
7 createElementForItem(item) { | 7 createElementForItem(item) { |
8 TestRunner.addResult('Creating element for ' + item); | 8 TestRunner.addResult('Creating element for ' + item); |
9 var element = document.createElement('div'); | 9 var element = document.createElement('div'); |
10 element.style.height = this.heightForItem(item) + 'px'; | 10 element.style.height = this.heightForItem(item) + 'px'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 TestRunner.addResult('Selection changed from ' + from + ' to ' + to); | 24 TestRunner.addResult('Selection changed from ' + from + ' to ' + to); |
25 if (fromElement) | 25 if (fromElement) |
26 fromElement.classList.remove('selected'); | 26 fromElement.classList.remove('selected'); |
27 if (toElement) | 27 if (toElement) |
28 toElement.classList.add('selected'); | 28 toElement.classList.add('selected'); |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 var delegate = new Delegate(); | 32 var delegate = new Delegate(); |
33 var list = new UI.ListControl(delegate); | 33 var list = new UI.ListControl(delegate); |
34 list.setHeightMode(UI.ListHeightMode.Variable); | 34 list.setMode(UI.ListMode.ViewportVariableItems); |
35 list.element.style.height = '73px'; | 35 list.element.style.height = '73px'; |
36 UI.inspectorView.element.appendChild(list.element); | 36 UI.inspectorView.element.appendChild(list.element); |
37 | 37 |
38 function dumpList() | 38 function dumpList() |
39 { | 39 { |
40 var height = list.element.offsetHeight; | 40 var height = list.element.offsetHeight; |
41 TestRunner.addResult(`----list[length=${list.length()}][height=${height}]----`
); | 41 TestRunner.addResult(`----list[length=${list.length()}][height=${height}]----`
); |
42 for (var child of list.element.children) { | 42 for (var child of list.element.children) { |
43 var offsetTop = child.getBoundingClientRect().top - list.element.getBounding
ClientRect().top; | 43 var offsetTop = child.getBoundingClientRect().top - list.element.getBounding
ClientRect().top; |
44 var offsetBottom = child.getBoundingClientRect().bottom - list.element.getBo
undingClientRect().top; | 44 var offsetBottom = child.getBoundingClientRect().bottom - list.element.getBo
undingClientRect().top; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 TestRunner.addResult('Replacing 45 with 16-18'); | 107 TestRunner.addResult('Replacing 45 with 16-18'); |
108 list.replaceItemsInRange(16, 17, [16, 17, 18]); | 108 list.replaceItemsInRange(16, 17, [16, 17, 18]); |
109 dumpList(); | 109 dumpList(); |
110 | 110 |
111 TestRunner.addResult('Resizing'); | 111 TestRunner.addResult('Resizing'); |
112 list.element.style.height = '190px'; | 112 list.element.style.height = '190px'; |
113 list.viewportResized(); | 113 list.viewportResized(); |
114 dumpList(); | 114 dumpList(); |
115 | 115 |
116 TestRunner.completeTest(); | 116 TestRunner.completeTest(); |
OLD | NEW |