From: Paul Felix Date: Thu, 10 Jan 2013 14:17:43 +0000 (-0500) Subject: More range selector auto tests X-Git-Tag: v1.0.0~124 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=ceb821aa39297f63cee99bc078130d7d98a79102;p=dygraphs.git More range selector auto tests --- diff --git a/auto_tests/tests/range_selector.js b/auto_tests/tests/range_selector.js index d93d63d..4ced4f2 100644 --- a/auto_tests/tests/range_selector.js +++ b/auto_tests/tests/range_selector.js @@ -129,6 +129,77 @@ 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');