X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Frange_tests.js;h=f14d30fdb71c034e996bd9358c756075d54420fb;hb=refs%2Ftags%2Fv2.0.0;hp=1391a2aa5a359671932ee00739b25cc94dc9dacc;hpb=8bd58e55cfd7d903d68ec434be1f17f78dc11de1;p=dygraphs.git diff --git a/auto_tests/tests/range_tests.js b/auto_tests/tests/range_tests.js index 1391a2a..f14d30f 100644 --- a/auto_tests/tests/range_tests.js +++ b/auto_tests/tests/range_tests.js @@ -19,11 +19,17 @@ // THE SOFTWARE. -/** +/** * @fileoverview Test valueRange and dateWindow changes. * * @author konigsberg@google.com (Robert Konigsberg) */ + +import Dygraph from '../../src/dygraph'; + +import DygraphOps from './DygraphOps'; +import {assertDeepCloseTo} from './custom_asserts'; + var ZERO_TO_FIFTY = [[ 10, 0 ] , [ 20, 50 ]]; var ZERO_TO_FIFTY_STEPS = (function() { var a = []; @@ -37,14 +43,12 @@ var ZERO_TO_FIFTY_STEPS = (function() { }()); var FIVE_TO_ONE_THOUSAND = [ - [ 1, 10 ], [ 2, 20 ], [ 3, 30 ], [ 4, 40 ] , [ 5, 50 ], + [ 1, 10 ], [ 2, 20 ], [ 3, 30 ], [ 4, 40 ] , [ 5, 50 ], [ 6, 60 ], [ 7, 70 ], [ 8, 80 ], [ 9, 90 ] , [ 10, 1000 ]]; describe("range-tests", function() { -beforeEach(function() { - document.body.innerHTML = "
"; -}); +cleanupAfterEach(); var createGraph = function(opts, data, expectRangeX, expectRangeY) { if (data === undefined) data = ZERO_TO_FIFTY_STEPS; @@ -102,7 +106,7 @@ it('testRangeSetOperations', function() { g.updateOptions({ }); assert.deepEqual([12, 18], g.xAxisRange()); assert.deepEqual([10, 40], g.yAxisRange(0)); - + g.updateOptions({valueRange : null, axes: {y:{valueRange : [15, 20]}}}); assert.deepEqual([12, 18], g.xAxisRange()); assert.deepEqual([15, 20], g.yAxisRange(0)); @@ -178,7 +182,7 @@ it('testLogScaleExcludesZero', function() { labels: ['X', 'Y'] }); assert.deepEqual([10, 1099], g.yAxisRange(0)); - + g.updateOptions({ logscale : false }); assert.deepEqual([0, 1099], g.yAxisRange(0)); }); @@ -192,7 +196,7 @@ it('testIncludeZeroIncludesZero', function() { labels: ['X', 'Y'] }); assert.deepEqual([0, 1100], g.yAxisRange(0)); - + g.updateOptions({ includeZero : false }); assert.deepEqual([450, 1050], g.yAxisRange(0)); }); @@ -202,14 +206,14 @@ it('testIncludeZeroIncludesZero', function() { * Verify that includeZero range is properly specified per axis. */ it('testIncludeZeroPerAxis', function() { - var g = new Dygraph("graph", + var g = new Dygraph("graph", 'X,A,B\n'+ '0,50,50\n'+ '50,110,110\n', { drawPoints: true, pointSize:5, - series:{ + series:{ A: { axis: 'y', pointSize: 10 @@ -217,7 +221,7 @@ it('testIncludeZeroPerAxis', function() { B: { axis: 'y2' } - }, + }, axes: { 'y2': { includeZero: true } } @@ -238,7 +242,7 @@ it('testIncludeZeroPerAxis', function() { /** * Verify that very large Y ranges don't break things. - */ + */ it('testHugeRange', function() { var g = new Dygraph("graph", [[0, -1e120], [1, 1e230]], { includeZero: true, @@ -249,15 +253,6 @@ it('testHugeRange', function() { }); /** - * Verify old-style avoidMinZero option. - */ -it('testAvoidMinZero', function() { - var g = createGraph({ - avoidMinZero: true, - }, ZERO_TO_FIFTY_STEPS, [10, 20], [-5, 55]); -}); - -/** * Verify ranges with user-specified padding, implicit avoidMinZero. */ it('testPaddingAuto', function() { @@ -338,24 +333,7 @@ it('testLogscalePad', function() { yRangePad: 30 }, [[-10, 10], [10, 10], [30, 1000]], - [-10, 30], [5.01691, 1993.25801]); -}); - -/** - * Verify scrolling all-zero region, traditional. - */ -it('testZeroScroll', function() { - var g = new Dygraph( - document.getElementById("graph"), - "X,Y\n" + - "1,0\n" + - "8,0\n" + - "9,0.1\n", - { - drawAxesAtZero: true, - animatedZooms: true, - avoidMinZero: true - }); + [-10, 30], [5.623, 1778.279]); }); /**