Add test suite for DygraphOptions object. Fix broken method in it.
[dygraphs.git] / auto_tests / tests / dygraph-options-tests.js
1 /**
2 * @fileoverview Test cases for DygraphOptions.
3 */
4 var DygraphOptionsTestCase = TestCase("dygraph-options-tests");
5
6 DygraphOptionsTestCase.prototype.setUp = function() {
7 document.body.innerHTML = "<div id='graph'></div>";
8 };
9
10 DygraphOptionsTestCase.prototype.tearDown = function() {
11 };
12
13 /*
14 * Pathalogical test to ensure getSeriesNames works
15 */
16 DygraphOptionsTestCase.prototype.testGetSeriesNames = function() {
17 var opts = {
18 width: 480,
19 height: 320
20 };
21 var data = "X,Y,Y2,Y3\n" +
22 "0,-1,0,0";
23
24 // Kind of annoying that you need a DOM to test the object.
25 var graph = document.getElementById("graph");
26 var g = new Dygraph(graph, data, opts);
27
28 // We don't need to get at g's attributes_ object just
29 // to test DygraphOptions.
30 var o = new DygraphOptions(g);
31 assertEquals(["Y", "Y2", "Y3"], o.seriesNames());
32 };