Compare commits

..

2 Commits

Author SHA1 Message Date
AllenFang
765a49fb07 Publish
- react-bootstrap-table-next@0.1.12
2018-05-23 22:44:40 +08:00
Allen
fe2fd93c20 fix the bool rendering issues in React (#340) (#348) 2018-05-23 22:42:46 +08:00
3 changed files with 23 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-bootstrap-table-next",
"version": "0.1.11",
"version": "0.1.12",
"description": "Next generation of react-bootstrap-table",
"main": "./lib/index.js",
"repository": {

View File

@@ -88,7 +88,9 @@ class Cell extends Component {
cellAttrs.onDoubleClick = this.handleEditingCell;
}
return (
<td { ...cellAttrs }>{ content }</td>
<td { ...cellAttrs }>
{ typeof content === 'boolean' ? `${content}` : content }
</td>
);
}
}

View File

@@ -27,6 +27,25 @@ describe('Cell', () => {
});
});
describe('when content is bool value', () => {
const column = {
dataField: 'col1',
text: 'column 1'
};
const aRowWithBoolValue = { col1: true };
beforeEach(() => {
wrapper = shallow(
<Cell row={ aRowWithBoolValue } columnIndex={ 1 } rowIndex={ 1 } column={ column } />
);
});
it('should render successfully', () => {
expect(wrapper.length).toBe(1);
expect(wrapper.text()).toEqual(aRowWithBoolValue[column.dataField].toString());
});
});
describe('when column.formatter prop is defined', () => {
const rowIndex = 1;
const column = {