Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/community/grafana/precision.patch
blob: 4471a7ce7928460d51e757675883854ef5593be6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- a/public/app/plugins/panel/graph/specs/graph_specs.ts	2017-09-15 21:04:37.456367729 +0200
+++ a/public/app/plugins/panel/graph/specs/graph_specs.ts	2017-09-15 21:04:35.832435741 +0200
@@ -133,12 +133,16 @@
     it('should apply axis transform, autoscaling (if necessary) and ticks', function() {
       var axisAutoscale = ctx.plotOptions.yaxes[0];
       expect(axisAutoscale.transform(100)).to.be(2);
-      expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
-      expect(axisAutoscale.min).to.be(0.001);
+      expect(axisAutoscale.inverseTransform(-3)).to.within(0.00099999999,0.00100000001);
+      expect(axisAutoscale.min).to.within(0.00099999999,0.00100000001);
       expect(axisAutoscale.max).to.be(10000);
-      expect(axisAutoscale.ticks.length).to.be(8);
-      expect(axisAutoscale.ticks[0]).to.be(0.001);
-      expect(axisAutoscale.ticks[7]).to.be(10000);
+      expect(axisAutoscale.ticks.length).to.within(7,8);
+      expect(axisAutoscale.ticks[0]).to.within(0.00099999999,0.00100000001);
+      if (axisAutoscale.ticks.length === 7) {
+        expect(axisAutoscale.ticks[axisAutoscale.ticks.length-1]).to.within(999.9999,1000.0001);
+      } else {
+        expect(axisAutoscale.ticks[axisAutoscale.ticks.length-1]).to.be(10000);
+      }
 
       var axisFixedscale = ctx.plotOptions.yaxes[1];
       expect(axisFixedscale.min).to.be(0.05);
@@ -162,7 +166,7 @@
     it('should not set min and max and should create some fake ticks', function() {
       var axisAutoscale = ctx.plotOptions.yaxes[0];
       expect(axisAutoscale.transform(100)).to.be(2);
-      expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
+      expect(axisAutoscale.inverseTransform(-3)).to.within(0.00099999999,0.00100000001);
       expect(axisAutoscale.min).to.be(undefined);
       expect(axisAutoscale.max).to.be(undefined);
       expect(axisAutoscale.ticks.length).to.be(2);
@@ -187,7 +191,7 @@
     it('should set min to 0.1 and add a tick for 0.1', function() {
       var axisAutoscale = ctx.plotOptions.yaxes[0];
       expect(axisAutoscale.transform(100)).to.be(2);
-      expect(axisAutoscale.inverseTransform(-3)).to.be(0.001);
+      expect(axisAutoscale.inverseTransform(-3)).to.within(0.00099999999,0.00100000001);
       expect(axisAutoscale.min).to.be(0.1);
       expect(axisAutoscale.max).to.be(10000);
       expect(axisAutoscale.ticks.length).to.be(6);