1 // Copyright 2011 Google Inc. All Rights Reserved.
4 * @fileoverview Regression test based on an optimization w/
5 * unforeseen consequences.
6 * @author danvk@google.com (Dan Vanderkam)
9 var SelectionTestCase
= TestCase("selection");
11 SelectionTestCase
.prototype.setUp
= function() {
12 document
.body
.innerHTML
= "<div id='graph'></div>";
15 SelectionTestCase
.prototype.testSetGetSelection
= function() {
16 var graph
= document
.getElementById("graph");
17 var g
= new Dygraph(graph
,
25 assertEquals(0, g
.getSelection());
27 assertEquals(1, g
.getSelection());
29 assertEquals(2, g
.getSelection());
32 SelectionTestCase
.prototype.testSetGetSelectionDense
= function() {
33 var graph
= document
.getElementById("graph");
34 var g
= new Dygraph(graph
,
43 assertEquals(0, g
.getSelection());
45 assertEquals(1, g
.getSelection());
47 assertEquals(2, g
.getSelection());
49 assertEquals(3, g
.getSelection());
52 SelectionTestCase
.prototype.testSetGetSelectionMissingPoints
= function() {
53 dataHandler
= function() {};
54 dataHandler
.prototype = new Dygraph
.DataHandlers
.DefaultHandler();
55 dataHandler
.prototype.seriesToPoints
= function(series
, setName
, boundaryIdStart
) {
59 } else if (setName
== 'B') {
61 } else if (setName
== 'C') {
73 var graph
= document
.getElementById("graph");
74 var g
= new Dygraph(graph
,
80 dataHandler
: dataHandler
85 assertEquals(0, g
.getSelection());
87 assertEquals(1, g
.getSelection());
89 assertEquals(2, g
.getSelection());