From 9bda5a1d1f49c98e069afacc304390af974df58a Mon Sep 17 00:00:00 2001 From: eberldav Date: Thu, 13 Jun 2013 10:13:04 +0200 Subject: [PATCH] TEST: Added test to verify that the left boundry works now. --- auto_tests/tests/missing_points.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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); +}; -- 2.7.4