*
* @author danvdk@gmail.com (Dan Vanderkam)
*/
+import Dygraph from '../../src/dygraph';
+import * as utils from '../../src/dygraph-utils';
describe("data-api", function() {
+cleanupAfterEach();
+
var opts, graphDiv;
beforeEach(function() {
- document.body.innerHTML = "<div id='graph'></div>";
opts = {
width: 480,
height: 320
graphDiv = document.getElementById("graph");
});
-afterEach(function() {
-});
-
it('testBasicAccessors', function() {
var g = new Dygraph(graphDiv, temperature_data, opts);
assert.equal(5, g.getRowForX(9));
});
+// indexFromSeriesName should return a value even if the series is invisible
+// In 1.1.1, if you request the last set and it's invisible, the method returns undefined.
+it('testIndexFromSetNameOnInvisibleSet', function() {
+
+ var localOpts = utils.clone(opts);
+ localOpts.visibility = [true, false];
+
+ var g = new Dygraph(graphDiv, [
+ "x,y1,y2",
+ "1,1,1",
+ "2,2,2",
+ "3,3,3"
+ ].join('\n'), localOpts);
+
+ assert.equal(2, g.indexFromSetName("y2"));
+});
+
});