Fix: Table Panel and string values & numeric formatting (#16249)

This commit is contained in:
Šimon Podlipský
2019-03-27 15:18:15 +01:00
committed by Torkel Ödegaard
parent ad6b11c90a
commit 00a07c855d
2 changed files with 7 additions and 2 deletions

View File

@@ -177,7 +177,7 @@ export class TableRenderer {
return '-';
}
if (_.isString(v) || _.isArray(v)) {
if (isNaN(v) || _.isArray(v)) {
return this.defaultCellFormatter(v, column.style);
}

View File

@@ -224,7 +224,12 @@ describe('when rendering table', () => {
expect(html).toBe('<td>1.230 s</td>');
});
it('number style should ignore string values', () => {
it('number column should format numeric string values', () => {
const html = renderer.renderCell(1, 0, '1230');
expect(html).toBe('<td>1.230 s</td>');
});
it('number style should ignore string non-numeric values', () => {
const html = renderer.renderCell(1, 0, 'asd');
expect(html).toBe('<td>asd</td>');
});