X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fupdate_options.js;h=ac28e99b2abc38fe5670e26cac8c11ef31f81325;hb=b85358e2c7dc73ec1179feb17b9060e132fcdbec;hp=482b92b937705e3632b91060da588c4aa6644d48;hpb=45efb72601da32d7686628c0984234ec8f6867b0;p=dygraphs.git diff --git a/auto_tests/tests/update_options.js b/auto_tests/tests/update_options.js index 482b92b..ac28e99 100644 --- a/auto_tests/tests/update_options.js +++ b/auto_tests/tests/update_options.js @@ -151,3 +151,24 @@ UpdateOptionsTestCase.prototype.testUpdateColors = function() { graph.updateOptions({ colors: null, file: this.data }); assertEquals(defaultColors, graph.getColors()); } + +// Regression test for http://code.google.com/p/dygraphs/issues/detail?id=249 +// Verifies that setting 'legend: always' via update immediately shows the +// legend. +UpdateOptionsTestCase.prototype.testUpdateLegendAlways = function() { + var graphDiv = document.getElementById("graph"); + var graph = new Dygraph(graphDiv, this.data, this.opts); + + var legend = document.getElementsByClassName("dygraph-legend"); + assertEquals(1, legend.length); + legend = legend[0]; + assertEquals("", legend.innerHTML); + + graph.updateOptions({legend: 'always'}); + + legend = document.getElementsByClassName("dygraph-legend"); + assertEquals(1, legend.length); + legend = legend[0]; + assertNotEquals(-1, legend.textContent.indexOf("Y1")); + assertNotEquals(-1, legend.textContent.indexOf("Y2")); +};