Skip to content

Commit 7b55311

Browse files
committed
test for average item height refactoring
1 parent e0be2e6 commit 7b55311

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

test/PaddingsSpec.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -282,33 +282,33 @@ describe('uiScroll Paddings spec.', () => {
282282
);
283283
});
284284

285-
// it('should append 3 rows via index-based applyUpdates when min/max indicies are set', () => {
286-
// runTest(Object.assign({}, scrollSettings, { startIndex: 28 }),
287-
// (viewport, scope) => {
288-
// const newItems = [
289-
// 'item' + (datasource.max + 1),
290-
// 'item' + (datasource.max + 2),
291-
// 'item' + (datasource.max + 3)
292-
// ];
293-
// const oldMax = datasource.max;
294-
// const _scrollTop = viewport.scrollTop();
295-
296-
// datasource.minIndex = datasource.min;
297-
// datasource.maxIndex = datasource.max;
298-
299-
// insertItems(datasource, datasource.max, newItems);
300-
// scope.adapter.applyUpdates(oldMax, ['item' + oldMax, ...newItems]);
301-
302-
// scrollBottom(viewport);
303-
// expect(viewport.scrollTop()).toBe(_scrollTop + newItems.length * itemHeight);
304-
305-
// checkRow(viewport, 1, (datasource.max - 0) + ': ' + newItems[2], true);
306-
// checkRow(viewport, 2, (datasource.max - 1) + ': ' + newItems[1], true);
307-
// checkRow(viewport, 3, (datasource.max - 2) + ': ' + newItems[0], true);
308-
// checkRow(viewport, 4, oldMax + ': item' + oldMax, true);
309-
// }
310-
// );
311-
// });
285+
it('should append 3 rows via index-based applyUpdates when min/max indicies are set', () => {
286+
runTest(Object.assign({}, scrollSettings, { startIndex: 28 }),
287+
(viewport, scope) => {
288+
const newItems = [
289+
'item' + (datasource.max + 1),
290+
'item' + (datasource.max + 2),
291+
'item' + (datasource.max + 3)
292+
];
293+
const oldMax = datasource.max;
294+
295+
datasource.minIndex = datasource.min;
296+
datasource.maxIndex = datasource.max;
297+
const _scrollTop = viewport.scrollTop();
298+
299+
insertItems(datasource, datasource.max, newItems);
300+
scope.adapter.applyUpdates(oldMax, ['item' + oldMax, ...newItems]);
301+
302+
scrollBottom(viewport);
303+
expect(viewport.scrollTop()).toBe(_scrollTop + newItems.length * itemHeight);
304+
305+
checkRow(viewport, 1, (datasource.max - 0) + ': ' + newItems[2], true);
306+
checkRow(viewport, 2, (datasource.max - 1) + ': ' + newItems[1], true);
307+
checkRow(viewport, 3, (datasource.max - 2) + ': ' + newItems[0], true);
308+
checkRow(viewport, 4, oldMax + ': item' + oldMax, true);
309+
}
310+
);
311+
});
312312

313313
});
314314

0 commit comments

Comments
 (0)