From cee95ae0352c8d6ba525b94e7ec1f93d40e1a2cd Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Fri, 30 Nov 2012 10:21:32 -0500 Subject: [PATCH] Add test that shows that you can't put {} inside the series option. --- auto_tests/tests/per_series.js | 18 ++++++++++++++++++ dygraph-options.js | 4 ++++ 2 files changed, 22 insertions(+) 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; } -- 2.7.4