Skip to content

Commit 393e50a

Browse files
authored
test: add a missing virtualizer test case (#3912)
1 parent 269b084 commit 393e50a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎packages/component-base/test/virtualizer-scrolling.test.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,18 @@ describe('virtualizer - scrollbar scrolling', () => {
244244
it('should not throw on flush if size is not set', () => {
245245
expect(() => virtualizer.flush()).not.to.throw(Error);
246246
});
247+
248+
it('should have 0 for the first visible index when scrolled to start', async () => {
249+
virtualizer.size = 100000;
250+
251+
// Scroll to start, taking a couple of steps on the way
252+
const scrollPositions = [115000, 3500, 0];
253+
for (let i = 0; i < scrollPositions.length; i++) {
254+
scrollTarget.scrollTop = scrollPositions[i];
255+
await nextFrame();
256+
}
257+
258+
// The index of the first visible item should be 0
259+
expect(virtualizer.firstVisibleIndex).to.equal(0);
260+
});
247261
});

0 commit comments

Comments
 (0)