mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
parent
a50148fe85
commit
fe2fd93c20
4
packages/react-bootstrap-table2/src/cell.js
vendored
4
packages/react-bootstrap-table2/src/cell.js
vendored
@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user