X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fper_series.js;h=ab52addfdaa1cc2d27f091a6c755feac18cc3a27;hb=d66c74ef29a8ad222e7203911af1b46b37f5bde1;hp=a198a95474106bbb8316dcf6d69ace72af3d8c06;hpb=ed8df44ec5bb0b1445474652d4de8f9cd52ca2cb;p=dygraphs.git diff --git a/auto_tests/tests/per_series.js b/auto_tests/tests/per_series.js index a198a95..ab52add 100644 --- a/auto_tests/tests/per_series.js +++ b/auto_tests/tests/per_series.js @@ -12,7 +12,6 @@ perSeriesTestCase.prototype.setUp = function() { perSeriesTestCase.prototype.tearDown = function() { }; - perSeriesTestCase.prototype.testPerSeriesFill = function() { var opts = { width: 480, @@ -101,3 +100,67 @@ perSeriesTestCase.prototype.testNewStyleSeriesTrumpsOldStyle = function() { assertEquals(5, g.getOption("pointSize", "Y")); }; +// TODO(konigsberg): move to multiple_axes.js +perSeriesTestCase.prototype.testAxisInNewSeries = function() { + var opts = { + series : { + D : { axis : 'y2' }, + C : { axis : 1 }, + B : { axis : 0 }, + E : { axis : 'y' } + } + }; + var graph = document.getElementById("graph"); + var data = "X,A,B,C,D,E\n0,1,2,3,4,5\n"; + g = new Dygraph(graph, data, opts); + + assertEquals(["A", "B", "E"], g.attributes_.seriesForAxis(0)); + assertEquals(["C", "D"], g.attributes_.seriesForAxis(1)); +}; + +// TODO(konigsberg): move to multiple_axes.js +perSeriesTestCase.prototype.testAxisInNewSeries_withAxes = function() { + var opts = { + series : { + D : { axis : 'y2' }, + C : { axis : 1 }, + B : { axis : 0 }, + E : { axis : 'y' } + }, + axes : { + y : { pointSize : 7 }, + y2 : { pointSize : 6 } + } + }; + var graph = document.getElementById("graph"); + var data = "X,A,B,C,D,E\n0,1,2,3,4,5\n"; + g = new Dygraph(graph, data, opts); + + assertEquals(["A", "B", "E"], g.attributes_.seriesForAxis(0)); + assertEquals(["C", "D"], g.attributes_.seriesForAxis(1)); + + assertEquals(1.5, g.getOption("pointSize")); + assertEquals(7, g.getOption("pointSize", "A")); + assertEquals(7, g.getOption("pointSize", "B")); + assertEquals(6, g.getOption("pointSize", "C")); + 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); + } +}