Commit | Line | Data |
---|---|---|
395e98a3 DV |
1 | /** |
2 | * @fileoverview Tests zero and one-point charts. | |
3 | * These don't have to render nicely, they just have to not crash. | |
4 | * | |
5 | * @author dan@dygraphs.com (Dan Vanderkam) | |
6 | */ | |
7 | var pathologicalCasesTestCase = TestCase("pathological-cases"); | |
8 | ||
9 | pathologicalCasesTestCase.prototype.setUp = function() { | |
10 | document.body.innerHTML = "<div id='graph'></div>"; | |
11 | }; | |
12 | ||
13 | pathologicalCasesTestCase.prototype.tearDown = function() { | |
14 | }; | |
15 | ||
16 | pathologicalCasesTestCase.prototype.testZeroPoint = function() { | |
17 | var opts = { | |
18 | width: 480, | |
19 | height: 320 | |
20 | }; | |
21 | var data = "X,Y\n"; | |
22 | ||
23 | var graph = document.getElementById("graph"); | |
24 | var g = new Dygraph(graph, data, opts); | |
25 | }; | |
26 | ||
27 | pathologicalCasesTestCase.prototype.testOnePoint = function() { | |
28 | var opts = { | |
29 | width: 480, | |
30 | height: 320 | |
31 | }; | |
32 | var data = "X,Y\n" + | |
33 | "1,2\n"; | |
34 | ||
35 | var graph = document.getElementById("graph"); | |
36 | var g = new Dygraph(graph, data, opts); | |
37 | }; | |
e0ff43a1 DV |
38 | |
39 | pathologicalCasesTestCase.prototype.testNullLegend = function() { | |
40 | var opts = { | |
41 | width: 480, | |
42 | height: 320, | |
43 | labelsDiv: null | |
44 | }; | |
45 | var data = "X,Y\n" + | |
46 | "1,2\n"; | |
47 | ||
48 | var graph = document.getElementById("graph"); | |
49 | var g = new Dygraph(graph, data, opts); | |
50 | }; | |
2c623e51 RK |
51 | |
52 | pathologicalCasesTestCase.prototype.testNoWidth = function() { | |
53 | var opts = { | |
54 | height: 300, | |
55 | }; | |
56 | var data = "X,Y\n" + | |
57 | "1,2\n"; | |
58 | ||
59 | var graph = document.getElementById("graph"); | |
60 | var g = new Dygraph(graph, data, opts); | |
61 | assertEquals(480, g.getOption("width")); | |
62 | assertEquals(300, g.getOption("height")); | |
63 | }; | |
64 | ||
65 | ||
66 | pathologicalCasesTestCase.prototype.testNoHeight = function() { | |
67 | var opts = { | |
68 | width: 479, | |
69 | }; | |
70 | var data = "X,Y\n" + | |
71 | "1,2\n"; | |
72 | ||
73 | var graph = document.getElementById("graph"); | |
74 | var g = new Dygraph(graph, data, opts); | |
75 | assertEquals(479, g.getOption("width")); | |
76 | assertEquals(320, g.getOption("height")); | |
77 | }; | |
78 | ||
79 | pathologicalCasesTestCase.prototype.testNoWidthOrHeight = function() { | |
80 | var opts = { | |
81 | }; | |
82 | var data = "X,Y\n" + | |
83 | "1,2\n"; | |
84 | ||
85 | var graph = document.getElementById("graph"); | |
86 | var g = new Dygraph(graph, data, opts); | |
87 | assertEquals(480, g.getOption("width")); | |
88 | assertEquals(320, g.getOption("height")); | |
89 | }; |