projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump to version 2 🎉
[dygraphs.git]
/
auto_tests
/
tests
/
pathological_cases.js
diff --git
a/auto_tests/tests/pathological_cases.js
b/auto_tests/tests/pathological_cases.js
index
40e877f
..
326fefb
100644
(file)
--- a/
auto_tests/tests/pathological_cases.js
+++ b/
auto_tests/tests/pathological_cases.js
@@
-4,15
+4,26
@@
*
* @author dan@dygraphs.com (Dan Vanderkam)
*/
*
* @author dan@dygraphs.com (Dan Vanderkam)
*/
+
+import Dygraph from '../../src/dygraph';
+import Util from './Util';
+
describe("pathological-cases", function() {
describe("pathological-cases", function() {
+cleanupAfterEach();
+
+var restoreConsole;
+var logs = {};
beforeEach(function() {
beforeEach(function() {
-
document.body.innerHTML = "<div id='graph'></div>"
;
+
restoreConsole = Util.captureConsole(logs)
;
});
afterEach(function() {
});
afterEach(function() {
+ restoreConsole();
});
});
+var graph = document.getElementById("graph");
+
it('testZeroPoint', function() {
var opts = {
width: 480,
it('testZeroPoint', function() {
var opts = {
width: 480,
@@
-20,7
+31,6
@@
it('testZeroPoint', function() {
};
var data = "X,Y\n";
};
var data = "X,Y\n";
- var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
});
var g = new Dygraph(graph, data, opts);
});
@@
-32,7
+42,6
@@
it('testOnePoint', function() {
var data = "X,Y\n" +
"1,2\n";
var data = "X,Y\n" +
"1,2\n";
- var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
});
var g = new Dygraph(graph, data, opts);
});
@@
-61,10
+70,6
@@
it('testCombinations', function() {
var variantOpts = {
none: {},
var variantOpts = {
none: {},
- avoidMinZero: {
- avoidMinZero: true,
- includeZero: true
- },
padded: {
includeZero: true,
drawAxesAtZero: true,
padded: {
includeZero: true,
drawAxesAtZero: true,
@@
-81,7
+86,6
@@
it('testCombinations', function() {
var opts = {
width: 300,
height: 150,
var opts = {
width: 300,
height: 150,
- labelsDivWidth: 100,
pointSize: 10
};
for (var key in base) {
pointSize: 10
};
for (var key in base) {
@@
-93,7
+97,7
@@
it('testCombinations', function() {
var h = document.createElement('h3');
h.appendChild(document.createTextNode(baseName + ' ' + variantName));
var h = document.createElement('h3');
h.appendChild(document.createTextNode(baseName + ' ' + variantName));
-
document.body
.appendChild(h);
+
graph
.appendChild(h);
for (var dataName in dataSets) {
var data = dataSets[dataName];
for (var dataName in dataSets) {
var data = dataSets[dataName];
@@
-105,12
+109,22
@@
it('testCombinations', function() {
var gdiv = document.createElement('div');
gdiv.style.display = 'inline-block';
box.appendChild(gdiv);
var gdiv = document.createElement('div');
gdiv.style.display = 'inline-block';
box.appendChild(gdiv);
-
document.body
.appendChild(box);
+
graph
.appendChild(box);
var cols = data && data[0] ? data[0].length : 0;
opts.labels = ['X', 'A', 'B', 'C'].slice(0, cols);
var g = new Dygraph(gdiv, data, opts);
var cols = data && data[0] ? data[0].length : 0;
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: []});
+ }
}
}
}
}
}
}
@@
-125,7
+139,6
@@
it('testNullLegend', function() {
var data = "X,Y\n" +
"1,2\n";
var data = "X,Y\n" +
"1,2\n";
- var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
});
var g = new Dygraph(graph, data, opts);
});