consolidating scripts
[dygraphs.git] / auto_tests / tests / multi_csv.js
CommitLineData
d7beab6b
DV
1/**
2 * @fileoverview Test cases for how axis labels are chosen and formatted.
3 *
4 * @author dan@dygraphs.com (Dan Vanderkam)
5 */
d7beab6b 6
e8c70e4e 7import Dygraph from '../../src/dygraph';
d7beab6b 8
e8c70e4e
DV
9describe("multi-csv", function() {
10
11cleanupAfterEach();
d7beab6b
DV
12
13function 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
89fdcedb 22it('testOneCSV', function() {
d7beab6b
DV
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
89fdcedb
DV
37 assert.deepEqual(['0', '1', '2'], getXLabels());
38});
d7beab6b 39
89fdcedb 40it('testTwoCSV', function() {
d7beab6b
DV
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
89fdcedb 55 assert.deepEqual(['0', '1', '2'], getXLabels());
d7beab6b
DV
56
57 g.updateOptions({file: data});
58
89fdcedb
DV
59 assert.deepEqual(['0', '1', '2'], getXLabels());
60});
61
62});