Skip to content

Commit

Permalink
🐛 Fix filterIcon Tooltip title is not working
Browse files Browse the repository at this point in the history
close #20049
  • Loading branch information
afc163 committed Dec 3, 2019
1 parent 92b4589 commit c49b9c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions components/table/__tests__/Table.filter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion components/table/filterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit c49b9c3

Please sign in to comment.