Skip to content

Commit

Permalink
Remove redundant formatting of percentage column (#64948)
Browse files Browse the repository at this point in the history
* Remove redundant formatting of percentage column

* Fix functional test

* Fix browser test
  • Loading branch information
kertal authored May 6, 2020
1 parent 3ca63a6 commit 9dc5c7d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ describe('Table Vis - AggTable Directive', function() {
);

$percentageColValues.each((i, value) => {
const percentage = `${round((counts[i] / total) * 100, 1)}%`;
const percentage = `${round((counts[i] / total) * 100, 3)}%`;
expect(value).to.be(percentage);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_table/public/agg_table/agg_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function addPercentageCol(columns, title, rows, insertAtIndex) {
formatter,
});
const newRows = rows.map(row => ({
[newId]: formatter.convert(row[id] / sumTotal / 100),
[newId]: row[id] / sumTotal,
...row,
}));

Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/visualize/_data_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ export default function({ getService, getPageObjects }) {
const data = await PageObjects.visChart.getTableVisData();
expect(data.trim().split('\n')).to.be.eql([
'≥ 0B and < 1,000B',
'1,351 64.7%',
'1,351 64.703%',
'≥ 1,000B and < 1.953KB',
'737 35.3%',
'737 35.297%',
]);
}

Expand Down

0 comments on commit 9dc5c7d

Please sign in to comment.