mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
empty noDataIndication when empty (#275)
* don't display unneeded empty row when noDataIndication isn't set
This commit is contained in:
parent
4501ddb632
commit
41dc3ef619
3
packages/react-bootstrap-table2/src/body.js
vendored
3
packages/react-bootstrap-table2/src/body.js
vendored
@ -35,6 +35,9 @@ const Body = (props) => {
|
||||
|
||||
if (isEmpty) {
|
||||
const indication = _.isFunction(noDataIndication) ? noDataIndication() : noDataIndication;
|
||||
if (!indication) {
|
||||
return null;
|
||||
}
|
||||
content = <RowSection content={ indication } colSpan={ visibleColumnSize } />;
|
||||
} else {
|
||||
const nonEditableRows = cellEdit.nonEditableRows || [];
|
||||
|
||||
@ -53,12 +53,10 @@ describe('Body', () => {
|
||||
/>);
|
||||
});
|
||||
|
||||
it('should render successfully', () => {
|
||||
it('should not render', () => {
|
||||
expect(wrapper.length).toBe(1);
|
||||
expect(wrapper.find('tbody').length).toBe(1);
|
||||
expect(wrapper.find(RowSection).length).toBe(1);
|
||||
expect(wrapper.find(RowSection).prop('colSpan')).toBe(columns.length);
|
||||
expect(wrapper.find(RowSection).prop('content')).toBe(null);
|
||||
expect(wrapper.find('tbody').length).toBe(0);
|
||||
expect(wrapper.find(RowSection).length).toBe(0);
|
||||
});
|
||||
|
||||
describe('when noDataIndication props is defined', () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user