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 describe("selection", function() {
11 beforeEach(function() {
12 document
.body
.innerHTML
= "<div id='graph'></div>";
15 it('testSetGetSelection', function() {
16 var graph
= document
.getElementById("graph");
17 var g
= new Dygraph(graph
,
25 assert
.equal(0, g
.getSelection());
27 assert
.equal(1, g
.getSelection());
29 assert
.equal(2, g
.getSelection());
32 it('testSetGetSelectionDense', function() {
33 var graph
= document
.getElementById("graph");
34 var g
= new Dygraph(graph
,
43 assert
.equal(0, g
.getSelection());
45 assert
.equal(1, g
.getSelection());
47 assert
.equal(2, g
.getSelection());
49 assert
.equal(3, g
.getSelection());
52 it('testSetGetSelectionMissingPoints', function() {
53 var 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 assert
.equal(0, g
.getSelection());
87 assert
.equal(1, g
.getSelection());
89 assert
.equal(2, g
.getSelection());