X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fsanity.js;h=95a1aa28e75d23918a9a944120d7dcbe5cd8cc9c;hb=87c5a64c0521a645972b52e3a767d14548a06bc3;hp=ebe8302c58d1b2918fb8682cd9729baf6657c37b;hpb=1ca7887e3c55b8863a1902af2fc35d433093ddef;p=dygraphs.git diff --git a/auto_tests/tests/sanity.js b/auto_tests/tests/sanity.js index ebe8302..95a1aa2 100644 --- a/auto_tests/tests/sanity.js +++ b/auto_tests/tests/sanity.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 Google, Inc. +// Copyright (c) 2011 Google, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -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,8 +97,42 @@ 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 +// without exception. +//TODO(konigsberg): Move to its own test case. +SanityTestCase.prototype.testFillStack1 = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY, { stackedGraph: true }); +} + +SanityTestCase.prototype.testFillStack2 = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY, { stackedGraph: true, fillGraph: true }); +} + +SanityTestCase.prototype.testFillStack3 = function() { + var graph = document.getElementById("graph"); + new Dygraph(graph, ZERO_TO_FIFTY, { fillGraph: true }); +}