From 5fdfe3b17bedde8627f94b490c5a2a74bc26c78c Mon Sep 17 00:00:00 2001 From: clocksmith Date: Mon, 25 Feb 2013 11:58:15 -0500 Subject: [PATCH] Add tests for underlayCallback with no series. --- auto_tests/tests/callback.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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)); +}; -- 2.7.4