*/
describe("pathological-cases", function() {
+var restoreConsole;
+var logs = {};
beforeEach(function() {
document.body.innerHTML = "<div id='graph'></div>";
+ restoreConsole = Util.captureConsole(logs);
});
afterEach(function() {
+ restoreConsole();
});
it('testZeroPoint', function() {
opts.labels = ['X', 'A', 'B', 'C'].slice(0, cols);
var g = new Dygraph(gdiv, data, opts);
+
+ if (dataName == 'empty') {
+ assert.deepEqual(logs, {
+ log: [], warn: [],
+ error: ["Can't plot empty data set"]
+ });
+ logs.error = []; // reset
+ } else {
+ assert.deepEqual(logs, {log: [], warn: [], error: []});
+ }
}
}
}
assert.deepEqual([-1.1, 0], g.yAxisRange());
});
+it('should throw with non-existent divs', function() {
+ var data = "X,Y\n" +
+ "1,-1\n" +
+ "2,1\n";
+
+ assert.throws(function() {
+ new Dygraph(null, data);
+ }, /non-existent div/);
+
+ assert.throws(function() {
+ new Dygraph('non-existent-div-id', data);
+ }, /non-existent div/);
+});
+
});