From ae62ac64d11f7f4cade8f7dca556a15fffe287fc Mon Sep 17 00:00:00 2001 From: Bilal Shafi Date: Mon, 27 May 2024 02:46:17 +0500 Subject: [PATCH] Add test --- .../src/tests/filtering.DataGridPro.test.tsx | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/x-data-grid-pro/src/tests/filtering.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/filtering.DataGridPro.test.tsx index 8c919672114a..ca93456329fd 100644 --- a/packages/x-data-grid-pro/src/tests/filtering.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/filtering.DataGridPro.test.tsx @@ -15,6 +15,7 @@ import { gridExpandedSortedRowEntriesSelector, gridClasses, GridColDef, + getGridStringOperators, } from '@mui/x-data-grid-pro'; import { createRenderer, fireEvent, screen, act, within } from '@mui-internal/test-utils'; import { expect } from 'chai'; @@ -1057,6 +1058,46 @@ describe(' - Filter', () => { expect(getColumnHeaderCell(0, 1).textContent).to.equal('Custom Input'); }); + + // See https://github.com/mui/mui-x/issues/13217 + it('should not throw when custom filter operator is used with an initilaized value', () => { + expect(() => { + render( + () => true, + InputComponent: () =>
Custom Input
, + }, + ], + }, + ]} + initialState={{ + filter: { + filterModel: { + items: [ + { + field: 'brand', + operator: 'looksLike', + value: 'a', + }, + ], + }, + }, + }} + headerFilters + />, + ); + }).not.toErrorDev(); + }); }); describe('Read-only filters', () => {