diff --git a/src/Table.tsx b/src/Table.tsx index 8e74719e8..41d2cd877 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -570,11 +570,12 @@ function Table(tableProps: TableProps 0) { + warning( + false, + 'When use `components.body` with render props. Each column should have a fixed `width` value.', + ); + } return 0; }) as number[]; } else { @@ -599,7 +600,11 @@ function Table(tableProps: TableProps +
{summaryNode}
)} diff --git a/tests/Table.spec.js b/tests/Table.spec.js index cd1ca8fd3..8e4fec37d 100644 --- a/tests/Table.spec.js +++ b/tests/Table.spec.js @@ -701,6 +701,24 @@ describe('Table.Basic', () => { }); }); + it('without warning - columns is emplty', () => { + resetWarned(); + const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + mount( + createTable({ + columns: [], + components: { + body: () =>

Bamboo

, + }, + scroll: { x: 100, y: 100 }, + }), + ); + expect(errSpy).not.toHaveBeenCalledWith( + 'Warning: When use `components.body` with render props. Each column should have a fixed `width` value.', + ); + errSpy.mockRestore(); + }); + it('not crash', () => { const Looper = React.forwardRef(() => ); Looper.looper = Looper;