浏览代码

HUE-4743 [editor] Queries don't need to have ms in the time counter(do not show more than 2 digits for precision)

Adrian Yavorskyy 8 年之前
父节点
当前提交
5bb4b051ac

+ 1 - 0
desktop/core/src/desktop/static/desktop/js/hue.utils.js

@@ -530,6 +530,7 @@ Number.prototype.toHHMMSS = function (skipZeroSeconds) {
   var n = this;
   var millis = n % 1000;
   n = (n - millis) / 1000;
+  millis = +((millis / 1000).toFixed(2)) * 100;
   var seconds = n % 60;
   n = (n - seconds) / 60;
   var minutes = n % 60;

+ 1 - 1
desktop/core/src/desktop/static/desktop/spec/hueUtilsSpec.js

@@ -21,7 +21,7 @@
     });
 
     it("should show the milliseconds in number format if the time is less than 60 seconds", function() {
-      expect(Number(10123).toHHMMSS()).toEqual('10.123s');
+      expect(Number(10123).toHHMMSS()).toEqual('10.12s');
     });
 
     it("should skip the seconds if it's zero and it's specified in the function", function() {