Browse Source

🐛 Fix filterIcon Tooltip title is not working

close #20049
pull/20056/head
afc163 5 years ago
committed by 偏右
parent
commit
16ac3b31df
  1. 19
      components/table/__tests__/Table.filter.test.js
  2. 2
      components/table/filterDropdown.tsx

19
components/table/__tests__/Table.filter.test.js

@ -671,6 +671,25 @@ describe('Table.filter', () => {
expect(wrapper.render()).toMatchSnapshot();
});
it('renders custom filter icon with right Tooltip title', () => {
const filterIcon = () => (
<Tooltip title="title" visible>
Tooltip
</Tooltip>
);
const wrapper = mount(
createTable({
columns: [
{
...column,
filterIcon,
},
],
}),
);
expect(wrapper.render()).toMatchSnapshot();
});
// https://github.com/ant-design/ant-design/issues/13028
it('reset dropdown filter correctly', () => {
class Demo extends React.Component {

2
components/table/filterDropdown.tsx

@ -224,7 +224,7 @@ class FilterMenu<T> extends React.Component<FilterMenuProps<T>, FilterMenuState<
if (React.isValidElement(filterIcon)) {
return React.cloneElement(filterIcon, {
title: locale.filterTitle,
title: filterIcon.props.title || locale.filterTitle,
className: classNames(`${prefixCls}-icon`, dropdownIconClass, filterIcon.props.className),
onClick: stopPropagation,
});

Loading…
Cancel
Save