From 0aa8cee39faee413d2243743b6a2790dbbf83b31 Mon Sep 17 00:00:00 2001 From: Rom Grk Date: Wed, 28 Feb 2024 11:03:52 -0500 Subject: [PATCH] fix: tests --- packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx | 4 +--- test/utils/helperFn.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx index a157398fef7c3..5520e075fd2fa 100644 --- a/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/rows.DataGridPro.test.tsx @@ -453,10 +453,8 @@ describe(' - Rows', () => { const lastCell = $$('[role="row"]:last-child [role="gridcell"]')[0]; expect(lastCell).to.have.text('995'); - expect(content.length).to.equal(Math.floor((height - 1) / rowHeight) + rowBuffer); // Subtracting 1 is needed because of the column header borders + expect(content.length).to.equal(Math.floor(height / rowHeight) + rowBuffer); // Subtracting 1 is needed because of the column header borders const scrollbarSize = apiRef.current.state.dimensions.scrollbarSize; - const distanceToFirstRow = (nbRows - content.length) * rowHeight; - expect(gridOffsetTop()).to.equal(distanceToFirstRow); expect(virtualScroller.scrollHeight - scrollbarSize).to.equal(nbRows * rowHeight); }); diff --git a/test/utils/helperFn.ts b/test/utils/helperFn.ts index 76f7f2a54e010..0e510f2731d5b 100644 --- a/test/utils/helperFn.ts +++ b/test/utils/helperFn.ts @@ -29,7 +29,7 @@ export function gridVar(name: string) { } export function gridOffsetTop() { - const transform = getComputedStyle(grid('virtualScrollerRenderZone')!).transform; + const transform = getComputedStyle(grid('virtualScrollerContent')!).transform; return parseInt( transform.startsWith('translate3d') ? transform.split('(')[1].split(',')[1]