Skip to content

Commit 9dc5c7d

Browse files
authored
Remove redundant formatting of percentage column (#64948)
* Remove redundant formatting of percentage column * Fix functional test * Fix browser test
1 parent 3ca63a6 commit 9dc5c7d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/legacy/core_plugins/kibana/public/__tests__/vis_type_table/agg_table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ describe('Table Vis - AggTable Directive', function() {
415415
);
416416

417417
$percentageColValues.each((i, value) => {
418-
const percentage = `${round((counts[i] / total) * 100, 1)}%`;
418+
const percentage = `${round((counts[i] / total) * 100, 3)}%`;
419419
expect(value).to.be(percentage);
420420
});
421421
});

src/plugins/vis_type_table/public/agg_table/agg_table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ function addPercentageCol(columns, title, rows, insertAtIndex) {
258258
formatter,
259259
});
260260
const newRows = rows.map(row => ({
261-
[newId]: formatter.convert(row[id] / sumTotal / 100),
261+
[newId]: row[id] / sumTotal,
262262
...row,
263263
}));
264264

test/functional/apps/visualize/_data_table.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ export default function({ getService, getPageObjects }) {
100100
const data = await PageObjects.visChart.getTableVisData();
101101
expect(data.trim().split('\n')).to.be.eql([
102102
'≥ 0B and < 1,000B',
103-
'1,351 64.7%',
103+
'1,351 64.703%',
104104
'≥ 1,000B and < 1.953KB',
105-
'737 35.3%',
105+
'737 35.297%',
106106
]);
107107
}
108108

0 commit comments

Comments
 (0)