From: Robert Konigsberg Date: Fri, 30 Nov 2012 15:21:32 +0000 (-0500) Subject: Add test that shows that you can't put {} inside the series option. X-Git-Tag: v1.0.0~156^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=cee95ae0352c8d6ba525b94e7ec1f93d40e1a2cd;p=dygraphs.git Add test that shows that you can't put {} inside the series option. --- diff --git a/auto_tests/tests/per_series.js b/auto_tests/tests/per_series.js index 8d81c7b..ab52add 100644 --- a/auto_tests/tests/per_series.js +++ b/auto_tests/tests/per_series.js @@ -146,3 +146,21 @@ perSeriesTestCase.prototype.testAxisInNewSeries_withAxes = function() { assertEquals(6, g.getOption("pointSize", "D")); assertEquals(7, g.getOption("pointSize", "E")); }; + +// TODO(konigsberg): move to multiple_axes.js +perSeriesTestCase.prototype.testOldAxisSpecInNewSeriesThrows = function() { + var opts = { + series : { + D : { axis : {} }, + }, + }; + var graph = document.getElementById("graph"); + var data = "X,A,B,C,D,E\n0,1,2,3,4,5\n"; + try { + new Dygraph(graph, data, opts); + } catch(e) { + assertEquals( + "Using objects for axis specification is not supported inside the 'series' option.", + e); + } +} diff --git a/dygraph-options.js b/dygraph-options.js index e18b726..8352d32 100644 --- a/dygraph-options.js +++ b/dygraph-options.js @@ -72,6 +72,10 @@ DygraphOptions.axisToIndex_ = function(axis) { } throw "Dygraphs only supports two y-axes, indexed from 0-1." } + if (typeof(axis) == "object") { + throw "Using objects for axis specification " + + "is not supported inside the 'series' option."; + } if (axis) { throw "Unknown axis : " + axis; }