bb8e8522a9ea56c089c9ea2d9381aef4897b5edf
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 import Dygraph from
'../../src/dygraph';
10 import DefaultHandler from
'../../src/datahandler/default';
12 describe("selection", function() {
16 it('testSetGetSelection', function() {
17 var graph
= document
.getElementById("graph");
18 var g
= new Dygraph(graph
,
26 assert
.equal(0, g
.getSelection());
28 assert
.equal(1, g
.getSelection());
30 assert
.equal(2, g
.getSelection());
33 it('testSetGetSelectionDense', function() {
34 var graph
= document
.getElementById("graph");
35 var g
= new Dygraph(graph
,
44 assert
.equal(0, g
.getSelection());
46 assert
.equal(1, g
.getSelection());
48 assert
.equal(2, g
.getSelection());
50 assert
.equal(3, g
.getSelection());
53 it('testSetGetSelectionMissingPoints', function() {
54 var dataHandler
= function() {};
55 dataHandler
.prototype = new DefaultHandler();
56 dataHandler
.prototype.seriesToPoints
= function(series
, setName
, boundaryIdStart
) {
60 } else if (setName
== 'B') {
62 } else if (setName
== 'C') {
74 var graph
= document
.getElementById("graph");
75 var g
= new Dygraph(graph
,
81 dataHandler
: dataHandler
86 assert
.equal(0, g
.getSelection());
88 assert
.equal(1, g
.getSelection());
90 assert
.equal(2, g
.getSelection());