X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fper_series.js;h=8a7e081f66d55670a38d6a889ff15398fcf65d98;hb=07270a6d3c41dbff993fa891d7d48ec03ad94641;hp=bba18adebd9d7ffd4e356e1ec093a82869023787;hpb=632bd78ca394e97157f2e09e0f10a05f813a810b;p=dygraphs.git diff --git a/auto_tests/tests/per_series.js b/auto_tests/tests/per_series.js index bba18ad..8a7e081 100644 --- a/auto_tests/tests/per_series.js +++ b/auto_tests/tests/per_series.js @@ -20,7 +20,9 @@ perSeriesTestCase.prototype.testPerSeriesFill = function() { drawYGrid: false, drawXAxis: false, drawYAxis: false, - Y: { fillGraph: true }, + series: { + Y: { fillGraph: true }, + }, colors: [ '#FF0000', '#0000FF' ], fillAlpha: 0.15 }; @@ -100,9 +102,9 @@ perSeriesTestCase.prototype.testNewStyleSeriesTrumpsOldStyle = function() { assertEquals(5, g.getOption("pointSize", "Y")); }; +// TODO(konigsberg): move to multiple_axes.js perSeriesTestCase.prototype.testAxisInNewSeries = function() { var opts = { - logscale: true, series : { D : { axis : 'y2' }, C : { axis : 1 }, @@ -114,11 +116,11 @@ perSeriesTestCase.prototype.testAxisInNewSeries = function() { var data = "X,A,B,C,D,E\n0,1,2,3,4,5\n"; g = new Dygraph(graph, data, opts); - assertEquals(5, g.getOption("pointSize")); - assertEquals(4, g.getOption("pointSize", "Y")); - assertEquals(5, g.getOption("pointSize", "Z")); + 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 : { @@ -128,15 +130,49 @@ perSeriesTestCase.prototype.testAxisInNewSeries_withAxes = function() { E : { axis : 'y' } }, axes : { - y : {}, - y2 : {} + 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(5, g.getOption("pointSize")); - assertEquals(4, g.getOption("pointSize", "Y")); - assertEquals(5, g.getOption("pointSize", "Z")); + 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"; + var threw = false; + try { + new Dygraph(graph, data, opts); + } catch(e) { + threw = true; + } + + assertTrue(threw); +} + +perSeriesTestCase.prototype.testColorOption = function() { + var graph = document.getElementById("graph"); + var data = "X,A,B,C\n0,1,2,3\n"; + var g = new Dygraph(graph, data, {}); + assertEquals(['rgb(64,128,0)', 'rgb(64,0,128)', 'rgb(0,128,128)'], g.getColors()); + g.updateOptions({series : { B : { color : 'purple' }}}); + assertEquals(['rgb(64,128,0)', 'purple', 'rgb(0,128,128)'], g.getColors()); +}