X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Frange_selector.js;h=4ced4f290bd498ef0c2d7f4bba6c40604fb6a37d;hb=d66c74ef29a8ad222e7203911af1b46b37f5bde1;hp=4ddfcb1663002444adda187b7a6eab3fa02e384e;hpb=ccd9d7c2bf76882f57d29161fe69b0db53124f54;p=dygraphs.git diff --git a/auto_tests/tests/range_selector.js b/auto_tests/tests/range_selector.js index 4ddfcb1..4ced4f2 100644 --- a/auto_tests/tests/range_selector.js +++ b/auto_tests/tests/range_selector.js @@ -129,12 +129,83 @@ RangeSelectorTestCase.prototype.testRangeSelectorOptions = function() { this.assertGraphExistence(g, graph); }; +RangeSelectorTestCase.prototype.testRangeSelectorEnablingAfterCreation = function() { + var opts = { + width: 480, + height: 320 + }; + var data = [ + [1, 10], + [2, 15], + [3, 10], + [4, 15], + [5, 10], + [6, 15], + [7, 10], + [8, 15], + [9, 10] + ]; + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, data, opts); + g.updateOptions({showRangeSelector: true}); + this.assertGraphExistence(g, graph); +}; + +// The animatedZooms option does not work with the range selector. Make sure it gets turned off. +RangeSelectorTestCase.prototype.testRangeSelectorWithAnimatedZoomsOption = function() { + var opts = { + width: 480, + height: 320, + showRangeSelector: true, + animatedZooms: true + }; + var data = [ + [1, 10], + [2, 15], + [3, 10], + [4, 15], + [5, 10], + [6, 15], + [7, 10], + [8, 15], + [9, 10] + ]; + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, data, opts); + this.assertGraphExistence(g, graph); + assertFalse(g.getOption('animatedZooms')); +}; + +RangeSelectorTestCase.prototype.testRangeSelectorWithAnimatedZoomsOption2 = function() { + var opts = { + width: 480, + height: 320, + animatedZooms: true + }; + var data = [ + [1, 10], + [2, 15], + [3, 10], + [4, 15], + [5, 10], + [6, 15], + [7, 10], + [8, 15], + [9, 10] + ]; + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, data, opts); + g.updateOptions({showRangeSelector: true}); + this.assertGraphExistence(g, graph); + assertFalse(g.getOption('animatedZooms')); +}; + RangeSelectorTestCase.prototype.assertGraphExistence = function(g, graph) { assertNotNull(g); - var zoomhandles = graph.getElementsByClassName('dygraph_rangesel_zoomhandle'); + var zoomhandles = graph.getElementsByClassName('dygraph-rangesel-zoomhandle'); assertEquals(2, zoomhandles.length); - var bgcanvas = graph.getElementsByClassName('dygraph_rangesel_bgcanvas'); + var bgcanvas = graph.getElementsByClassName('dygraph-rangesel-bgcanvas'); assertEquals(1, bgcanvas.length); - var fgcanvas = graph.getElementsByClassName('dygraph_rangesel_fgcanvas'); + var fgcanvas = graph.getElementsByClassName('dygraph-rangesel-fgcanvas'); assertEquals(1, fgcanvas.length); }