From: clocksmith Date: Mon, 25 Feb 2013 16:58:15 +0000 (-0500) Subject: Add tests for underlayCallback with no series. X-Git-Tag: v1.0.0~48^2~3 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=5fdfe3b17bedde8627f94b490c5a2a74bc26c78c;p=dygraphs.git Add tests for underlayCallback with no series. --- diff --git a/auto_tests/tests/callback.js b/auto_tests/tests/callback.js index e44e397..1d748fb 100644 --- a/auto_tests/tests/callback.js +++ b/auto_tests/tests/callback.js @@ -565,3 +565,27 @@ CallbackTestCase.prototype.testHighlightCallbackRow = function() { assertEquals(2, highlightRow); assertEquals('2: Y: 3 Z: 4', Util.getLegend()); }; + +/** + * Test that underlay callback is called even when there are no series, + * and that the y axis ranges are not NaN. + */ +CallbackTestCase.prototype.underlayCallback_noSeries = function() { + var called = false; + var yMin, yMax; + + var callback = function(canvas, area, g) { + called = true; + yMin = g.yAxisRange(0)[0]; + yMax = g.yAxisRange(0)[0]; + }; + + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, "\n", { + underlayCallback: callback + }); + + assertTrue(called); + assertFalse(isNaN(yMin)); + assertFalse(isNaN(yMax)); +};