diff --git a/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx index 1a838c133227..86fc55cb0b6a 100644 --- a/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/rowReorder.DataGridPro.test.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { expect } from 'chai'; import { spy } from 'sinon'; import { createRenderer, fireEvent, screen, createEvent } from '@mui/internal-test-utils'; -import { getCell, getColumnValues, getRowsFieldContent } from 'test/utils/helperFn'; +import { getCell, getColumnValues, getRowsFieldContent, microtasks } from 'test/utils/helperFn'; import { useGridApiRef, DataGridPro, gridClasses, GridApi } from '@mui/x-data-grid-pro'; import { useBasicDemoData } from '@mui/x-data-grid-generator'; @@ -247,8 +247,7 @@ describe(' - Row reorder', () => { expect(getRowsFieldContent('brand')).to.deep.equal(['Skechers', 'Puma']); }); - it('should reorder rows correctly with filtered data', () => { - let apiRef: React.MutableRefObject; + it('should reorder rows correctly with filtered data', async () => { const rows = [ { id: 0, brand: 'Nike' }, { id: 1, brand: 'Adidas' }, @@ -258,12 +257,9 @@ describe(' - Row reorder', () => { const columns = [{ field: 'brand' }]; function Test() { - apiRef = useGridApiRef(); - return (
- Row reorder', () => { fireEvent.dragEnter(targetCell); const dragOverEvent = createDragOverEvent(targetCell); fireEvent(targetCell, dragOverEvent); + await microtasks(); expect(getColumnValues(1)).to.deep.equal(['Puma', 'Adidas', 'Skechers']); }); });