Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi committed May 26, 2024
1 parent 84c5d45 commit ae62ac6
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions packages/x-data-grid-pro/src/tests/filtering.DataGridPro.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -1057,6 +1058,46 @@ describe('<DataGridPro /> - 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(
<TestCase
columns={[
{
field: 'brand',
headerName: 'Brand',
filterOperators: [
...getGridStringOperators(),
{
value: 'looksLike',
label: 'Looks Like',
headerLabel: 'Looks Like',
getApplyFilterFn: () => () => true,
InputComponent: () => <div>Custom Input</div>,
},
],
},
]}
initialState={{
filter: {
filterModel: {
items: [
{
field: 'brand',
operator: 'looksLike',
value: 'a',
},
],
},
},
}}
headerFilters
/>,
);
}).not.toErrorDev();
});
});

describe('Read-only filters', () => {
Expand Down

0 comments on commit ae62ac6

Please sign in to comment.