aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-04-10 17:49:37 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-04-10 17:49:37 +0200
commita510bd69f4f66eb4b81ae19bca8b768ddc1c1ced (patch)
treee367fb843ec5063e6bab733c6154a8fddd586d2b /server/sonar-web/src/main
parent6294bc5b0b72515ed6eb0b0a3daed695081e5e25 (diff)
downloadsonarqube-a510bd69f4f66eb4b81ae19bca8b768ddc1c1ced.tar.gz
sonarqube-a510bd69f4f66eb4b81ae19bca8b768ddc1c1ced.zip
cover formatMeasure with tests
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/application.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/application.js b/server/sonar-web/src/main/js/application.js
index 592c1265493..c6af8866c87 100644
--- a/server/sonar-web/src/main/js/application.js
+++ b/server/sonar-web/src/main/js/application.js
@@ -300,11 +300,14 @@ function closeModalWindow () {
}
function shortIntVariationFormatter (value) {
+ if (value === 0) {
+ return '0';
+ }
var format = '+0,0';
- if (value >= 1000) {
+ if (Math.abs(value) >= 1000) {
format = '+0.[0]a';
}
- if (value >= 10000) {
+ if (Math.abs(value) >= 10000) {
format = '+0a';
}
return numeral(value).format(format);