From: David Eberlein Date: Fri, 12 Apr 2013 12:51:16 +0000 (+0200) Subject: TEST: Added automated test proving the bugfix made. X-Git-Tag: v1.0.0~39^2~2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=3718778b1adf052c63971e723542756ddd1b38fb;p=dygraphs.git TEST: Added automated test proving the bugfix made. --- diff --git a/auto_tests/tests/range_selector.js b/auto_tests/tests/range_selector.js index a27cad7..4772a47 100644 --- a/auto_tests/tests/range_selector.js +++ b/auto_tests/tests/range_selector.js @@ -318,6 +318,32 @@ RangeSelectorTestCase.prototype.testRangeSelectorInteraction = function() { assert(newXRange[1]+'<'+xRange[1], newXRange[1] < xRange[1]); }; + +RangeSelectorTestCase.prototype.testRangeSelectorPositionIfXAxisNotDrawn = function() { + var opts = { + width: 480, + height: 100, + xAxisHeight: 30, + drawXAxis: false, + showRangeSelector: true, + rangeSelectorHeight: 30 + }; + var data = [ + [0, 1], + [10, 1] + ]; + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, data, opts); + + //assert, that the range selector is at top position 70 since the 30px of the + // xAxis shouldn't be resevered since it isn't drawn. + this.assertGraphExistence(g, graph); + var bgcanvas = graph.getElementsByClassName('dygraph-rangesel-bgcanvas')[0]; + assertEquals("Range selector is not at the expected position.","70px", bgcanvas.style.top); + var fgcanvas = graph.getElementsByClassName('dygraph-rangesel-fgcanvas')[0]; + assertEquals("Range selector is not at the expected position.","70px", fgcanvas.style.top); +}; + RangeSelectorTestCase.prototype.assertGraphExistence = function(g, graph) { assertNotNull(g); var zoomhandles = graph.getElementsByClassName('dygraph-rangesel-zoomhandle');