Skip to content

Commit

Permalink
[test] Cover row grouping regression with a unit test (#8870)
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii authored May 11, 2023
1 parent e78f8c5 commit e3144d6
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2654,4 +2654,28 @@ describe('<DataGridPremium /> - Row Grouping', () => {
});
await waitFor(() => expect(getCell(1, 3).textContent).to.equal('username 2'));
});

// See https://github.com/mui/mui-x/issues/8853
it('should not reorder rows after calling `updateRows`', async () => {
render(
<Test
columns={[{ field: 'id' }, { field: 'group' }, { field: 'username', width: 150 }]}
rows={[
{ id: 1, group: 'A', username: 'username1' },
{ id: 2, group: 'A', username: 'username2' },
]}
rowGroupingModel={['group']}
defaultGroupingExpansionDepth={-1}
/>,
);

expect(getColumnValues(3)).to.deep.equal(['', 'username1', 'username2']);

// trigger row update without any changes in row data
act(() => apiRef.current.updateRows([{ id: 1 }]));

await waitFor(() => {
expect(getColumnValues(3)).to.deep.equal(['', 'username1', 'username2']);
});
});
});

0 comments on commit e3144d6

Please sign in to comment.