Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ yarn.lock
es/
.storybook
.doc
!tests/__mocks__/rc-util/lib
!tests/__mocks__/rc-util/lib
examples/debug.tsx
38 changes: 0 additions & 38 deletions examples/debug.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/Body/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ function Body<RecordType>({
getRowKey,
getComponent,
componentWidth,
emptyNode,
]);
}

Expand Down
53 changes: 38 additions & 15 deletions tests/Table.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,44 @@ describe('Table.Basic', () => {
});
});

it('renders empty text correctly', () => {
const wrapper1 = mount(createTable({ data: [], emptyText: 'No data' }));
const wrapper2 = mount(createTable({ data: [], emptyText: () => 'No data' }));
expect(
wrapper1
.find('.rc-table-placeholder')
.hostNodes()
.text(),
).toEqual('No data');
expect(
wrapper2
.find('.rc-table-placeholder')
.hostNodes()
.text(),
).toEqual('No data');
describe('renders empty text correctly', () => {
it('ReactNode', () => {
const wrapper = mount(createTable({ data: [], emptyText: 'No data' }));
expect(
wrapper
.find('.rc-table-placeholder')
.hostNodes()
.text(),
).toEqual('No data');
});

it('renderProps', () => {
const wrapper = mount(createTable({ data: [], emptyText: () => 'No data' }));
expect(
wrapper
.find('.rc-table-placeholder')
.hostNodes()
.text(),
).toEqual('No data');
});

it('effect update', () => {
const App = () => {
const [emptyText, setEmptyText] = React.useState('light');
React.useEffect(() => {
setEmptyText('bamboo');
}, []);
return <Table emptyText={emptyText} />;
};
const wrapper = mount(<App />);
wrapper.update();
expect(
wrapper
.find('.rc-table-placeholder')
.hostNodes()
.text(),
).toEqual('bamboo');
});
});

it('renders without header', () => {
Expand Down