d7f1a494d1eaaf69ebb71cd10a4fef7091489d9b
2 * @fileoverview Tests for per-axis options.
4 * @author konigsberg@google.com (Robert Konigsberg)
7 import Dygraph from
'../../src/dygraph';
8 import * as utils from
'../../src/dygraph-utils';
10 import Util from
'./Util';
11 import CanvasAssertions from
'./CanvasAssertions';
12 import Proxy from
'./Proxy';
14 describe("per-axis", function() {
17 useProxyCanvas(utils
, Proxy
);
19 var xAxisLineColor
= "#00ffff";
20 var yAxisLineColor
= "#ffff00";
24 beforeEach(function() {
30 gridLineColor
: xAxisLineColor
35 gridLineColor
: yAxisLineColor
38 colors
: [ '#ff0000', '#0000ff' ]
41 var data
= "X,Y,Z\n" +
45 graph
= document
.getElementById('graph');
46 g
= new Dygraph(graph
, data
, opts
);
49 it('testDrawXAxis', function() {
50 g
.updateOptions({ axes
: { x
: { drawAxis
: true }} });
51 assert
.isTrue(graph
.getElementsByClassName('dygraph-axis-label-x').length
> 0);
52 assert
.isTrue(graph
.getElementsByClassName('dygraph-axis-label-y').length
== 0);
55 it('testDrawYAxis', function() {
56 g
.updateOptions({ axes
: { y
: { drawAxis
: true }} });
57 assert
.isTrue(graph
.getElementsByClassName('dygraph-axis-label-x').length
==0);
58 assert
.isTrue(graph
.getElementsByClassName('dygraph-axis-label-y').length
> 0);
61 it('testDrawXGrid', function() {
62 g
.updateOptions({ axes
: { x
: { drawGrid
: true }}});
63 var htx
= g
.hidden_ctx_
;
64 assert
.isTrue(CanvasAssertions
.numLinesDrawn(htx
, xAxisLineColor
) > 0);
65 assert
.isTrue(CanvasAssertions
.numLinesDrawn(htx
, yAxisLineColor
) == 0);
68 it('testDrawYGrid', function() {
69 g
.updateOptions({ axes
: { y
: { drawGrid
: true }}});
70 var htx
= g
.hidden_ctx_
;
71 assert
.isTrue(CanvasAssertions
.numLinesDrawn(htx
, xAxisLineColor
) == 0);
72 assert
.isTrue(CanvasAssertions
.numLinesDrawn(htx
, yAxisLineColor
) > 0);