X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fsanity.js;h=95a1aa28e75d23918a9a944120d7dcbe5cd8cc9c;hb=48fc47867e9796ad49e105546fbb21c5304039c1;hp=243f5237439e3d771090c7e6a7d58fb7fc44fcd7;hpb=0d4989dbb907d4c5b5624d3a3a3cd21d7edeb8a9;p=dygraphs.git diff --git a/auto_tests/tests/sanity.js b/auto_tests/tests/sanity.js index 243f523..95a1aa2 100644 --- a/auto_tests/tests/sanity.js +++ b/auto_tests/tests/sanity.js @@ -80,6 +80,8 @@ SanityTestCase.prototype.testYAxisRange_custom = function() { var graph = document.getElementById("graph"); var g = new Dygraph(graph, ZERO_TO_FIFTY, { valueRange: [0,50] }); assertEquals([0, 50], g.yAxisRange(0)); + g.updateOptions({valueRange: null, axes: {y: {valueRange: [10, 40]}}}); + assertEquals([10, 40], g.yAxisRange(0)); }; /** @@ -95,10 +97,26 @@ SanityTestCase.prototype.testToDomYCoord = function() { assertEquals(50, g.toDomYCoord(0)); assertEquals(0, g.toDomYCoord(50)); - + for (var x = 0; x <= 50; x++) { assertEqualsDelta(50 - x, g.toDomYCoord(x), 0.00001); } + g.updateOptions({valueRange: null, axes: {y: {valueRange: [0, 50]}}}); + + assertEquals(50, g.toDomYCoord(0)); + assertEquals(0, g.toDomYCoord(50)); + + for (var x = 0; x <= 50; x++) { + assertEqualsDelta(50 - x, g.toDomYCoord(x), 0.00001); + } +}; + +/** + * Test that the two-argument form of the constructor (no options) works. + */ +SanityTestCase.prototype.testTwoArgumentConstructor = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY); }; // Here is the first of a series of tests that just ensure the graph is drawn