Bugfix: Import missing dygraph-utils.js
[dygraphs.git] / auto_tests / tests / multi_csv.js
1 /**
2 * @fileoverview Test cases for how axis labels are chosen and formatted.
3 *
4 * @author dan@dygraphs.com (Dan Vanderkam)
5 */
6
7 import Dygraph from '../../src/dygraph';
8
9 describe("multi-csv", function() {
10
11 cleanupAfterEach();
12
13 function getXLabels() {
14 var x_labels = document.getElementsByClassName("dygraph-axis-label-x");
15 var ary = [];
16 for (var i = 0; i < x_labels.length; i++) {
17 ary.push(x_labels[i].innerHTML);
18 }
19 return ary;
20 }
21
22 it('testOneCSV', function() {
23 var opts = {
24 width: 480,
25 height: 320
26 };
27 var data = "X,Y\n" +
28 "0,-1\n" +
29 "1,0\n" +
30 "2,1\n" +
31 "3,0\n"
32 ;
33
34 var graph = document.getElementById("graph");
35 var g = new Dygraph(graph, data, opts);
36
37 assert.deepEqual(['0', '1', '2'], getXLabels());
38 });
39
40 it('testTwoCSV', function() {
41 var opts = {
42 width: 480,
43 height: 320
44 };
45 var data = "X,Y\n" +
46 "0,-1\n" +
47 "1,0\n" +
48 "2,1\n" +
49 "3,0\n"
50 ;
51
52 var graph = document.getElementById("graph");
53 var g = new Dygraph(graph, data, opts);
54
55 assert.deepEqual(['0', '1', '2'], getXLabels());
56
57 g.updateOptions({file: data});
58
59 assert.deepEqual(['0', '1', '2'], getXLabels());
60 });
61
62 });