mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 11:39:28 +08:00
fix: undefined in filterDropdown in Table should not render dropdown filter icon. (#27002)
close #26988
This commit is contained in:
parent
514cc062be
commit
fa3c00ce1a
@ -69,6 +69,19 @@ describe('Table.filter', () => {
|
||||
expect(wrapper.find('.ant-table-filter-column')).toHaveLength(0);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/26988
|
||||
it('not show filter icon when filter and filterDropdown is undefined', () => {
|
||||
const noFilterColumn = { ...column, filters: undefined, filterDropdown: undefined };
|
||||
delete noFilterColumn.onFilter;
|
||||
const wrapper = mount(
|
||||
createTable({
|
||||
columns: [noFilterColumn],
|
||||
}),
|
||||
);
|
||||
|
||||
expect(wrapper.find('.ant-table-filter-column')).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('renders filter correctly', () => {
|
||||
const wrapper = mount(createTable());
|
||||
|
||||
|
@ -70,7 +70,7 @@ function injectFilter<RecordType>(
|
||||
const columnPos = getColumnPos(index, pos);
|
||||
const { filterMultiple = true } = column as ColumnType<RecordType>;
|
||||
|
||||
if (column.filters || 'filterDropdown' in column) {
|
||||
if (column.filters || column.filterDropdown) {
|
||||
const columnKey = getColumnKey(column, columnPos);
|
||||
const filterState = filterStates.find(({ key }) => columnKey === key);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user