Closurize dygraph-options.js. Not done.
[dygraphs.git] / auto_tests / tests / selection.js
CommitLineData
87bbdb4d
DV
1// Copyright 2011 Google Inc. All Rights Reserved.
2
3/**
4 * @fileoverview Regression test based on an optimization w/
5 * unforeseen consequences.
6 * @author danvk@google.com (Dan Vanderkam)
7 */
8
9var SelectionTestCase = TestCase("selection");
10
11SelectionTestCase.prototype.setUp = function() {
12 document.body.innerHTML = "<div id='graph'></div>";
13};
14
15SelectionTestCase.prototype.testSetGetSelection = function() {
16 var graph = document.getElementById("graph");
17 var g = new Dygraph(graph,
18 "X,Y\n" +
19 "1,1\n" +
20 "50,50\n" +
21 "100,100\n"
22 );
23
24 g.setSelection(0);
25 assertEquals(0, g.getSelection());
26 g.setSelection(1);
27 assertEquals(1, g.getSelection());
28 g.setSelection(2);
29 assertEquals(2, g.getSelection());
30};
31
32SelectionTestCase.prototype.testSetGetSelectionDense = function() {
33 var graph = document.getElementById("graph");
34 var g = new Dygraph(graph,
35 "X,Y\n" +
36 "1,1\n" +
37 "50,50\n" +
38 "50.0001,50.0001\n" +
39 "100,100\n"
40 );
41
42 g.setSelection(0);
43 assertEquals(0, g.getSelection());
44 g.setSelection(1);
45 assertEquals(1, g.getSelection());
46 g.setSelection(2);
47 assertEquals(2, g.getSelection());
48 g.setSelection(3);
49 assertEquals(3, g.getSelection());
50};