empty noDataIndication when empty (#275)

* don't display unneeded empty row when noDataIndication isn't set
This commit is contained in:
Patrick O'Meara 2018-04-01 15:32:24 +10:00 committed by Allen
parent 4501ddb632
commit 41dc3ef619
2 changed files with 6 additions and 5 deletions

View File

@ -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 || [];

View File

@ -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', () => {