X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fper_series.js;h=09c3c5cedc276e810561a5fb147d96d4ac37b743;hb=0a5aa490041ec62b5c7e4951d4d4e7a2fd345fc2;hp=ab52addfdaa1cc2d27f091a6c755feac18cc3a27;hpb=9838afeac7e8e46c5af67c495e73372fa30d668a;p=dygraphs.git diff --git a/auto_tests/tests/per_series.js b/auto_tests/tests/per_series.js index ab52add..09c3c5c 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 }; @@ -47,20 +49,6 @@ perSeriesTestCase.prototype.testPerSeriesFill = function() { assertEquals([255,0,0,38], sampler.colorAtCoordinate(6.5, 0.5)); }; -perSeriesTestCase.prototype.testOldStyleSeries = function() { - var opts = { - pointSize : 5, - Y: { pointSize : 4 }, - }; - var graph = document.getElementById("graph"); - var data = "X,Y,Z\n1,0,0\n"; - g = new Dygraph(graph, data, opts); - - assertEquals(5, g.getOption("pointSize")); - assertEquals(4, g.getOption("pointSize", "Y")); - assertEquals(5, g.getOption("pointSize", "Z")); -}; - perSeriesTestCase.prototype.testNewStyleSeries = function() { var opts = { pointSize : 5, @@ -77,29 +65,6 @@ perSeriesTestCase.prototype.testNewStyleSeries = function() { assertEquals(5, g.getOption("pointSize", "Z")); }; -perSeriesTestCase.prototype.testNewStyleSeriesTrumpsOldStyle = function() { - var opts = { - pointSize : 5, - Z : { pointSize : 6 }, - series : { - Y: { pointSize : 4 } - }, - }; - var graph = document.getElementById("graph"); - var data = "X,Y,Z\n1,0,0\n"; - g = new Dygraph(graph, data, opts); - - assertEquals(5, g.getOption("pointSize")); - assertEquals(4, g.getOption("pointSize", "Y")); - assertEquals(5, g.getOption("pointSize", "Z")); - - // Erase the series object, and Z will become visible again. - g.updateOptions({ series : undefined }); - assertEquals(5, g.getOption("pointSize")); - assertEquals(6, g.getOption("pointSize", "Z")); - assertEquals(5, g.getOption("pointSize", "Y")); -}; - // TODO(konigsberg): move to multiple_axes.js perSeriesTestCase.prototype.testAxisInNewSeries = function() { var opts = { @@ -156,11 +121,21 @@ perSeriesTestCase.prototype.testOldAxisSpecInNewSeriesThrows = function() { }; 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) { - assertEquals( - "Using objects for axis specification is not supported inside the 'series' option.", - 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()); }