From: clocksmith Date: Tue, 26 Feb 2013 18:26:46 +0000 (-0500) Subject: Added tests for explicit y axis range in callback. X-Git-Tag: v1.0.0~48^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=113f6e1600bbf74793f3ba1263116d7948061b69;p=dygraphs.git Added tests for explicit y axis range in callback. --- diff --git a/auto_tests/tests/callback.js b/auto_tests/tests/callback.js index 298fe8a..535bd0e 100644 --- a/auto_tests/tests/callback.js +++ b/auto_tests/tests/callback.js @@ -589,3 +589,25 @@ CallbackTestCase.prototype.underlayCallback_noSeries = function() { assertFalse(isNaN(yMin)); assertFalse(isNaN(yMax)); }; + +/** + * Test that underlay callback receives the correct y-axis range. + */ +CallbackTestCase.prototype.underlayCallback_yAxisRange = function() { + var called = false; + var yMin, yMax; + + var callback = function(canvas, area, g) { + yMin = g.yAxisRange(0)[0]; + yMax = g.yAxisRange(0)[1]; + }; + + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, "\n", { + valueRange: [0,10], + underlayCallback: callback + }); + + assertEquals(0, yMin)); + assertEquals(10, yMax)); +};