From: eberldav Date: Thu, 13 Jun 2013 08:13:04 +0000 (+0200) Subject: TEST: Added test to verify that the left boundry works now. X-Git-Tag: v1.0.0~17^2~2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=9bda5a1d1f49c98e069afacc304390af974df58a;p=dygraphs.git TEST: Added test to verify that the left boundry works now. --- diff --git a/auto_tests/tests/missing_points.js b/auto_tests/tests/missing_points.js index cf468f9..3a27759 100644 --- a/auto_tests/tests/missing_points.js +++ b/auto_tests/tests/missing_points.js @@ -307,3 +307,40 @@ MissingPointsTestCase.prototype.testCustomBarsWithMissingPointsConnected = funct [p1, p2, p3], { strokeStyle: '#ff0000' }); }; +MissingPointsTestCase.prototype.testLeftBoundaryWithMisingPoints = function() { + var data = [ + [1, null, 3], + [2, 1, null], + [3, 0, 5], + [4, 2, 1], + [5, 4, null], + [6, 3, 2] + ]; + var g = new Dygraph( + document.getElementById("graph"), + data, + { + connectSeparatedPoints: true, + drawPoints: true, + colors: ['red','blue'] + } + ); + g.updateOptions({ dateWindow : [ 2.5, 4.5 ] }); + assertEquals(1, g.getLeftBoundary_(0)); + assertEquals(0, g.getLeftBoundary_(1)); + + var domX = g.toDomXCoord(1.9); + var closestRow = g.findClosestRow(domX); + assertEquals(1, closestRow); + + g.setSelection(closestRow); + assertEquals(1, g.selPoints_.length); + assertEquals(1, g.selPoints_[0].yval); + + + g.setSelection(3); + assertEquals(2, g.selPoints_.length); + assertEquals(g.selPoints_[0].xval, g.selPoints_[1].xval); + assertEquals(2, g.selPoints_[0].yval); + assertEquals(1, g.selPoints_[1].yval); +};