consolidating scripts
[dygraphs.git] / auto_tests / tests / no_hours.js
CommitLineData
3f675fe5
DV
1/**
2 * @fileoverview Tests that we don'show specify hours, minutes or seconds
3 * in your dates if you don't specify them. This can get mixed up becaues of
4 * time zones.
5 *
6 * @author danvk@google.com (Dan Vanderkam)
7 */
3f675fe5 8
e8c70e4e
DV
9import Dygraph from '../../src/dygraph';
10import Util from './Util';
11
12describe("no-hours", function() {
3f675fe5 13
e8c70e4e 14cleanupAfterEach();
3f675fe5 15
89fdcedb 16it('testNoHours', function() {
3f675fe5
DV
17 var opts = {
18 width: 480,
19 height: 320
20 };
21 var data = "Date,Y\n" +
22 "2012/03/13,-1\n" +
23 "2012/03/14,0\n" +
24 "2012/03/15,1\n" +
25 "2012/03/16,0\n"
26 ;
27
28 var graph = document.getElementById("graph");
29 var g = new Dygraph(graph, data, opts);
30
31 g.setSelection(0);
89fdcedb 32 assert.equal("2012/03/13: Y: -1", Util.getLegend());
3f675fe5
DV
33
34 g.setSelection(1);
89fdcedb 35 assert.equal("2012/03/14: Y: 0", Util.getLegend());
3f675fe5
DV
36
37 g.setSelection(2);
89fdcedb 38 assert.equal("2012/03/15: Y: 1", Util.getLegend());
3f675fe5
DV
39
40 g.setSelection(3);
89fdcedb
DV
41 assert.equal("2012/03/16: Y: 0", Util.getLegend());
42});
3f675fe5 43
89fdcedb 44it('testNoHoursDashed', function() {
3f675fe5
DV
45 var opts = {
46 width: 480,
47 height: 320
48 };
49 var data = "Date,Y\n" +
50 "2012-03-13,-1\n" +
51 "2012-03-14,0\n" +
52 "2012-03-15,1\n" +
53 "2012-03-16,0\n"
54 ;
55
56 var graph = document.getElementById("graph");
57 var g = new Dygraph(graph, data, opts);
58
59 g.setSelection(0);
89fdcedb 60 assert.equal("2012/03/13: Y: -1", Util.getLegend());
3f675fe5
DV
61
62 g.setSelection(1);
89fdcedb 63 assert.equal("2012/03/14: Y: 0", Util.getLegend());
3f675fe5
DV
64
65 g.setSelection(2);
89fdcedb 66 assert.equal("2012/03/15: Y: 1", Util.getLegend());
3f675fe5
DV
67
68 g.setSelection(3);
89fdcedb
DV
69 assert.equal("2012/03/16: Y: 0", Util.getLegend());
70});
3f675fe5 71
89fdcedb
DV
72
73});