Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Oct 6, 2024
1 parent b575fa0 commit d0b1687
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
12 changes: 4 additions & 8 deletions packages/x-data-grid/src/tests/rowSelection.DataGrid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ describe('<DataGrid /> - Row selection', () => {
expect(getRow(0).querySelector('input')).to.have.property('checked', false);
});

it('should set focus on the cell when clicking the checkbox', async () => {
it('should set focus on the cell when clicking the checkbox', () => {
render(<TestDataGridSelection checkboxSelection />);
expect(getActiveCell()).to.equal(null);

Expand All @@ -237,9 +237,7 @@ describe('<DataGrid /> - Row selection', () => {

fireUserEvent.mousePress(checkboxInput!);

await waitFor(() => {
expect(getActiveCell()).to.equal('0-0');
});
expect(getActiveCell()).to.equal('0-0');
});

it('should select all visible rows regardless of pagination', () => {
Expand Down Expand Up @@ -384,9 +382,7 @@ describe('<DataGrid /> - Row selection', () => {
);
const selectAllCheckbox = screen.getByRole('checkbox', { name: 'Select all rows' });
fireEvent.click(selectAllCheckbox);
await act(() => {
expect(getSelectedRowIds()).to.deep.equal([0, 1, 2, 3]);
});
expect(getSelectedRowIds()).to.deep.equal([0, 1, 2, 3]);
expect(grid('selectedRowCount')?.textContent).to.equal('4 rows selected');

fireEvent.change(screen.getByRole('spinbutton', { name: 'Value' }), {
Expand Down Expand Up @@ -607,7 +603,7 @@ describe('<DataGrid /> - Row selection', () => {
});

describe('prop: isRowSelectable', () => {
it('should update the selected rows when the isRowSelectable prop changes', async () => {
it('should update the selected rows when the isRowSelectable prop changes', () => {
const { setProps } = render(
<TestDataGridSelection isRowSelectable={() => true} checkboxSelection />,
);
Expand Down
14 changes: 4 additions & 10 deletions packages/x-data-grid/src/tests/sorting.DataGrid.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { createRenderer, fireEvent, screen, act, waitFor } from '@mui/internal-test-utils';
import { createRenderer, fireEvent, screen, act } from '@mui/internal-test-utils';
import { expect } from 'chai';
import {
DataGrid,
Expand Down Expand Up @@ -712,9 +712,7 @@ describe('<DataGrid /> - Sorting', () => {
expect(getColumnValues(1)).to.deep.equal(['Adidas', 'Nike', 'Puma']);

setProps({ columns: [{ field: 'id' }] });
await waitFor(() => {
expect(getColumnValues(0)).to.deep.equal(['0', '1', '2']);
});
expect(getColumnValues(0)).to.deep.equal(['0', '1', '2']);
expect(onSortModelChange.callCount).to.equal(1);
expect(onSortModelChange.lastCall.firstArg).to.deep.equal([]);
});
Expand Down Expand Up @@ -747,9 +745,7 @@ describe('<DataGrid /> - Sorting', () => {
expect(getColumnValues(1)).to.deep.equal(['Adidas', 'Nike', 'Puma']);

setProps({ columns: [{ field: 'id' }], sortModel: [{ field: 'id', sort: 'desc' }] });
await waitFor(() => {
expect(getColumnValues(0)).to.deep.equal(['2', '1', '0']);
});
expect(getColumnValues(0)).to.deep.equal(['2', '1', '0']);
expect(onSortModelChange.callCount).to.equal(0);
});

Expand Down Expand Up @@ -790,9 +786,7 @@ describe('<DataGrid /> - Sorting', () => {

const header = getColumnHeaderCell(0);
fireEvent.click(header);
await waitFor(() => {
expect(getColumnValues(0)).to.deep.equal(['a', 'b', '', '']);
});
expect(getColumnValues(0)).to.deep.equal(['a', 'b', '', '']);

fireEvent.click(header);
expect(getColumnValues(0)).to.deep.equal(['b', 'a', '', '']);
Expand Down

0 comments on commit d0b1687

Please sign in to comment.