Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swap math.round with util.formatNumber #2361

Merged
merged 2 commits into from
May 25, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lighthouse-core/report/v2/renderer/report-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class ReportRenderer {
this._dom.find('.leftnav-item__category', navItem).textContent = category.name;
const score = this._dom.find('.leftnav-item__score', navItem);
score.classList.add(`lh-score__value--${Util.calculateRating(category.score)}`);
score.textContent = Math.round(Util.formatNumber(category.score));
score.textContent = Util.formatNumber(Math.round(category.score));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed about a consistent calculation of the final category score. We have a couple of places where you call Math.round(score).

That said, this nav score should be the same as the others. Those just use Math.round.

Math.round(category.score)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to change it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

nav.appendChild(navItem);
}
return leftNav;
Expand Down