From: Robert Konigsberg Date: Sat, 8 Dec 2012 23:32:34 +0000 (-0500) Subject: Add tests for labelsKMG and labelsKMB2. X-Git-Tag: v1.0.0~145 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=de624512adecc90456c0eba8969192876659c7cf;p=dygraphs.git Add tests for labelsKMG and labelsKMB2. --- diff --git a/auto_tests/tests/axis_labels.js b/auto_tests/tests/axis_labels.js index 9b36565..5c57fd6 100644 --- a/auto_tests/tests/axis_labels.js +++ b/auto_tests/tests/axis_labels.js @@ -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()); +};