Rewrite tests to use ES6 modules.
[dygraphs.git] / auto_tests / tests / fill_step_plot.js
CommitLineData
8c31c7db 1/**
a78b8bd0 2 * @fileoverview Test if you give null values to dygraph with stepPlot
8c31c7db
BB
3 * and fillGraph options enabled
4 *
5 * @author benoitboivin.pro@gmail.com (Benoit Boivin)
6 */
e8c70e4e
DV
7import Dygraph from '../../src/dygraph';
8import * as utils from '../../src/dygraph-utils';
9import CanvasAssertions from './CanvasAssertions';
10import Proxy from './Proxy';
11
89fdcedb 12describe("fill-step-plot", function() {
8c31c7db 13
e8c70e4e 14cleanupAfterEach();
8c31c7db 15
e8c70e4e 16var origFunc = utils.getContext;
8c31c7db 17
89fdcedb 18beforeEach(function() {
e8c70e4e 19 utils.getContext = function(canvas) {
319d0361 20 return new Proxy(origFunc(canvas));
8c31c7db 21 };
89fdcedb 22});
8c31c7db 23
89fdcedb 24afterEach(function() {
e8c70e4e 25 utils.getContext = origFunc;
89fdcedb 26});
8c31c7db
BB
27
28
89fdcedb 29it('testFillStepPlotNullValues', function() {
8c31c7db
BB
30 var opts = {
31 labels: ["x","y"],
32 width: 480,
33 height: 320,
34 fillGraph: true,
35 stepPlot: true
36 };
37 var data = [
38 [1,3],
39 [2,0],
40 [3,8],
41 [4,null],
42 [5,9],
43 [6,8],
44 [7,6],
45 [8,3]
46 ];
47 var graph = document.getElementById("graph");
48 var g = new Dygraph(graph, data, opts);
49
89fdcedb 50 var htx = g.hidden_ctx_;
8c31c7db
BB
51 var x1 = data[3][0];
52 var y1 = data[2][1];
53 var x2 = data[3][0];
54 var y2 = 0;
55 var xy1 = g.toDomCoords(x1, y1);
56 var xy2 = g.toDomCoords(x2, y2);
57
58 // Check if a line is drawn between the previous y and the bottom of the chart
a78b8bd0 59 CanvasAssertions.assertLineDrawn(htx, xy1, xy2, {});
89fdcedb
DV
60});
61
62});