Add tests for labelsKMG and labelsKMB2.
authorRobert Konigsberg <konigsberg@gmail.com>
Sat, 8 Dec 2012 23:32:34 +0000 (18:32 -0500)
committerRobert Konigsberg <konigsberg@gmail.com>
Sat, 8 Dec 2012 23:32:34 +0000 (18:32 -0500)
auto_tests/tests/axis_labels.js

index 9b36565..5c57fd6 100644 (file)
@@ -478,3 +478,49 @@ AxisLabelsTestCase.prototype.testSeriesOrder = function() {
   // Verify that we get the label list back in the right order
   assertEquals(["x", "00", "01", "10", "11"], g.getLabels());
 };
+
+AxisLabelsTestCase.prototype.testLabelKMB = function() {
+  var data = [];
+  data.push([0,0]);
+  data.push([1,2000]);
+  data.push([2,1000]);
+
+  var g = new Dygraph(
+    document.getElementById("graph"),
+    data,
+    {
+      labels: [ 'X', 'bar' ],
+      axes : {
+        y: {
+          labelsKMB: true
+        }
+      }
+    }
+  );
+
+  assertEquals(["0", "500", "1K", "1.5K", "2K"], Util.getYLabels());
+};
+
+AxisLabelsTestCase.prototype.testLabelKMG2 = function() {
+  var data = [];
+  data.push([0,0]);
+  data.push([1,2000]);
+  data.push([2,1000]);
+
+  var g = new Dygraph(
+    document.getElementById("graph"),
+    data,
+    {
+      labels: [ 'X', 'bar' ],
+      axes : {
+        y: {
+          labelsKMG2: true
+        }
+      }
+    }
+  );
+
+  assertEquals(
+      ["0","256","512","768","1k","1.25k","1.5k","1.75k","2k"],
+      Util.getYLabels());
+};