2 * @fileoverview Test cases for DygraphOptions.
4 var DygraphOptionsTestCase
= TestCase("dygraph-options-tests");
6 DygraphOptionsTestCase
.prototype.setUp
= function() {
7 document
.body
.innerHTML
= "<div id='graph'></div>";
10 DygraphOptionsTestCase
.prototype.tearDown
= function() {
14 * Pathalogical test to ensure getSeriesNames works
16 DygraphOptionsTestCase
.prototype.testGetSeriesNames
= function() {
21 var data
= "X,Y,Y2,Y3\n" +
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
);
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());
35 * Ensures that even if logscale is set globally, it doesn't impact the
38 DygraphOptionsTestCase
.prototype.getLogscaleForX
= function() {
43 var data
= "X,Y,Y2,Y3\n" +
46 // Kind of annoying that you need a DOM to test the object.
47 var graph
= document
.getElementById("graph");
48 var g
= new Dygraph(graph
, data
, opts
);
50 assertFalse(g
.getOptionForAxis('logscale', 'x'));
51 assertFalse(g
.getOptionForAxis('logscale', 'y'));
53 g
.updateOptions({ logscale
: true });
54 assertFalse(g
.getOptionForAxis('logscale', 'x'));
55 assertTrue(g
.getOptionForAxis('logscale', 'y'));