X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Frange_selector.js;h=584e054a7dad55d42f78558162907c4c8ec231e5;hb=20aaadda52577cfa97d25b350405726e7f51ffd1;hp=b04cbb5d161781d589a3f2805fe86e635aa87650;hpb=dc910fcebc0da0a621cf16073ebedabcff32fb12;p=dygraphs.git diff --git a/auto_tests/tests/range_selector.js b/auto_tests/tests/range_selector.js index b04cbb5..584e054 100644 --- a/auto_tests/tests/range_selector.js +++ b/auto_tests/tests/range_selector.js @@ -6,11 +6,15 @@ */ describe("range-selector", function() { +var restoreConsole; +var logs = {}; beforeEach(function() { document.body.innerHTML = "
"; + restoreConsole = Util.captureConsole(logs); }); afterEach(function() { + restoreConsole(); }); it('testRangeSelector', function() { @@ -183,8 +187,13 @@ it('testRangeSelectorEnablingAfterCreation', function() { ]; var graph = document.getElementById("graph"); var g = new Dygraph(graph, data, opts); + var initialChartHeight = g.getArea().h; g.updateOptions({showRangeSelector: true}); assertGraphExistence(g, graph); + assert(g.getArea().h < initialChartHeight); // range selector shown + + g.updateOptions({showRangeSelector: false}); + assert.equal(g.getArea().h, initialChartHeight); // range selector hidden }); // The animatedZooms option does not work with the range selector. Make sure it gets turned off. @@ -211,6 +220,10 @@ it('testRangeSelectorWithAnimatedZoomsOption', function() { var g = new Dygraph(graph, data, opts); assertGraphExistence(g, graph); assert.isFalse(g.getOption('animatedZooms')); + assert.deepEqual(logs, { + log: [], error: [], + warn: ["Animated zooms and range selector are not compatible; disabling animatedZooms."] + }); }); it('testRangeSelectorWithAnimatedZoomsOption2', function() { @@ -236,6 +249,10 @@ it('testRangeSelectorWithAnimatedZoomsOption2', function() { g.updateOptions({showRangeSelector: true}); assertGraphExistence(g, graph); assert.isFalse(g.getOption('animatedZooms')); + assert.deepEqual(logs, { + log: [], error: [], + warn: ["Animated zooms and range selector are not compatible; disabling animatedZooms."] + }); }); it('testRangeSelectorInteraction', function() { @@ -288,7 +305,7 @@ it('testRangeSelectorInteraction', function() { zoomhandles[0].dispatchEvent(mouseUpEvent); var newXRange = g.xAxisRange().slice(); - assert('left zoomhandle should have moved: '+newXRange[0]+'>'+xRange[0], newXRange[0] > xRange[0]); + assert(newXRange[0] > xRange[0], 'left zoomhandle should have moved: '+newXRange[0]+'>'+xRange[0]); assert.equal(xRange[1], newXRange[1], 'right zoomhandle should not have moved'); // Move right zoomhandle in @@ -353,8 +370,8 @@ it('testRangeSelectorInteraction', function() { fgcanvas.dispatchEvent(mouseUpEvent); var newXRange = g.xAxisRange().slice(); - assert(newXRange[0]+'<'+xRange[0], newXRange[0] < xRange[0]); - assert(newXRange[1]+'<'+xRange[1], newXRange[1] < xRange[1]); + assert(newXRange[0] < xRange[0], newXRange[0]+'<'+xRange[0]); + assert(newXRange[1] < xRange[1], newXRange[1]+'<'+xRange[1]); }); @@ -389,7 +406,6 @@ it('testMiniPlotDrawn', function() { var origFunc = Dygraph.getContext; var miniHtx; Dygraph.getContext = function(canvas) { - console.log(canvas.className); if (canvas.className != 'dygraph-rangesel-bgcanvas') { return origFunc(canvas); }