From e3144d6ad87ef50146494e33d85994073d17b1b9 Mon Sep 17 00:00:00 2001 From: Andrew Cherniavskii Date: Thu, 11 May 2023 17:39:36 +0200 Subject: [PATCH] [test] Cover row grouping regression with a unit test (#8870) --- .../rowGrouping.DataGridPremium.test.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/grid/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx b/packages/grid/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx index 7cc9bd991233..19d0cb65230b 100644 --- a/packages/grid/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx +++ b/packages/grid/x-data-grid-premium/src/tests/rowGrouping.DataGridPremium.test.tsx @@ -2654,4 +2654,28 @@ describe(' - 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( + , + ); + + 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']); + }); + }); });