فهرست منبع

add one more test

Peter Holmberg 6 سال پیش
والد
کامیت
94d129e479
2فایلهای تغییر یافته به همراه7 افزوده شده و 4 حذف شده
  1. 7 0
      packages/grafana-ui/src/utils/displayValue.test.ts
  2. 0 4
      packages/grafana-ui/src/utils/displayValue.ts

+ 7 - 0
packages/grafana-ui/src/utils/displayValue.test.ts

@@ -151,6 +151,13 @@ describe('Format value', () => {
     expect(instance(value).text).toEqual('1.2');
   });
 
+  it('should set auto decimals, 2 significant', () => {
+    const value = '0.0245';
+    const instance = getDisplayProcessor({ decimals: null });
+
+    expect(instance(value).text).toEqual('0.02');
+  });
+
   it('should return mapped value if there are matching value mappings', () => {
     const valueMappings: ValueMapping[] = [
       { id: 0, operator: '', text: '1-20', type: MappingType.RangeToText, from: '1', to: '20' },

+ 0 - 4
packages/grafana-ui/src/utils/displayValue.ts

@@ -61,10 +61,6 @@ export function getDisplayProcessor(options?: DisplayValueOptions): DisplayProce
             decimals = options.decimals;
           }
 
-          console.log('coin coin', value);
-          console.log(decimals);
-          console.log(scaledDecimals);
-
           text = formatFunc(numeric, decimals, scaledDecimals, options.isUtc);
         }
         if (thresholds && thresholds.length > 0) {