Skip to content

Commit

Permalink
fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed Sep 16, 2024
1 parent 738deb2 commit 40e09d0
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ describe('<DataGridPro /> - Infnite loader', () => {
}
const { container } = render(<TestCase rows={baseRows} pinnedRows={basePinnedRows} />);
const virtualScroller = container.querySelector('.MuiDataGrid-virtualScroller')!;
await sleep(1);
// after initial render and a scroll event that did not reach the bottom of the grid
// the `onRowsScrollEnd` should not be called
expect(handleRowsScrollEnd.callCount).to.equal(0);
// arbitrary number to make sure that the bottom of the grid window is reached.
virtualScroller.scrollTop = 12345;
virtualScroller.dispatchEvent(new Event('scroll'));
await sleep(1);
expect(handleRowsScrollEnd.callCount).to.equal(1);
await waitFor(() => {
expect(handleRowsScrollEnd.callCount).to.equal(1);
});
});
});

0 comments on commit 40e09d0

Please sign in to comment.