mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
parent
c4418d089c
commit
8d7cbbdb0f
@ -82,16 +82,23 @@ describe('Table.filter', () => {
|
||||
});
|
||||
|
||||
it('renders empty menu correctly', () => {
|
||||
const wrapper = mount(createTable({
|
||||
columns: [
|
||||
{
|
||||
...column,
|
||||
filters: [],
|
||||
},
|
||||
],
|
||||
}));
|
||||
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
||||
const wrapper = mount(
|
||||
createTable({
|
||||
columns: [
|
||||
{
|
||||
...column,
|
||||
filters: [],
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
wrapper.find('span.ant-dropdown-trigger').simulate('click', nativeEvent);
|
||||
expect(wrapper.find('Empty').length).toBe(1);
|
||||
// eslint-disable-next-line no-console
|
||||
expect(console.error).not.toHaveBeenCalled();
|
||||
// eslint-disable-next-line no-console
|
||||
console.error.mockRestore();
|
||||
});
|
||||
|
||||
it('renders radio filter correctly', () => {
|
||||
|
@ -34,17 +34,21 @@ function renderFilterItems({
|
||||
locale: TableLocale;
|
||||
}) {
|
||||
if (filters.length === 0) {
|
||||
// wrapped with <></> to avoid react warning
|
||||
// https://github.com/ant-design/ant-design/issues/25979
|
||||
return (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={locale.filterEmptyText}
|
||||
style={{
|
||||
margin: '16px 0',
|
||||
}}
|
||||
imageStyle={{
|
||||
height: 24,
|
||||
}}
|
||||
/>
|
||||
<>
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={locale.filterEmptyText}
|
||||
style={{
|
||||
margin: '16px 0',
|
||||
}}
|
||||
imageStyle={{
|
||||
height: 24,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
return filters.map((filter, index) => {
|
||||
|
Loading…
Reference in New Issue
Block a user