Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed May 4, 2023
1 parent 92641bd commit 0a2b87f
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 0a2b87f

Please sign in to comment.