*
* @author dan@dygraphs.com (Dan Vanderkam)
*/
-var pathologicalCasesTestCase = TestCase("pathological-cases");
+describe("pathological-cases", function() {
-pathologicalCasesTestCase.prototype.setUp = function() {
+beforeEach(function() {
document.body.innerHTML = "<div id='graph'></div>";
-};
+});
-pathologicalCasesTestCase.prototype.tearDown = function() {
-};
+afterEach(function() {
+});
-pathologicalCasesTestCase.prototype.testZeroPoint = function() {
+it('testZeroPoint', function() {
var opts = {
width: 480,
height: 320
var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
-};
+});
-pathologicalCasesTestCase.prototype.testOnePoint = function() {
+it('testOnePoint', function() {
var opts = {
width: 480,
height: 320
var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
-};
+});
-pathologicalCasesTestCase.prototype.testCombinations = function() {
+it('testCombinations', function() {
var dataSets = {
empty: [],
onePoint: [[10, 2]],
padded: {
includeZero: true,
drawAxesAtZero: true,
- xRangePad: 0.02,
- yRangePad: 0.04
+ xRangePad: 2,
+ yRangePad: 4
}
};
}
}
}
-};
+});
-pathologicalCasesTestCase.prototype.testNullLegend = function() {
+it('testNullLegend', function() {
var opts = {
width: 480,
height: 320,
var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
-};
+});
-pathologicalCasesTestCase.prototype.testDivAsString = function() {
+it('testDivAsString', function() {
var data = "X,Y\n" +
"1,2\n";
var g = new Dygraph('graph', data, {});
-}
+});
+
+
+it('testConstantSeriesNegative', function() {
+ var data = "X,Y\n" +
+ "1,-1\n" +
+ "2,-1\n";
+
+ var g = new Dygraph('graph', data, {});
+ // This check could be loosened to
+ // g.yAxisRange()[0] < g.yAxisRange()[1] if it breaks in the future.
+ assert.deepEqual([-1.1, -0.9], g.yAxisRange());
+});
+
+
+it('testConstantSeriesNegativeIncludeZero', function() {
+ var data = "X,Y\n" +
+ "1,-1\n" +
+ "2,-1\n";
+
+ var g = new Dygraph('graph', data, {includeZero: true});
+ // This check could be loosened to
+ // g.yAxisRange()[0] < g.yAxisRange()[1] if it breaks in the future.
+ assert.deepEqual([-1.1, 0], g.yAxisRange());
+});
+
+});