2 * @fileoverview Test cases for a graph contained in a scrolling div
4 * @author konigsberg@google.com (Robert Konigsbrg)
6 var ScrollingDivTestCase
= TestCase("scrolling-div");
8 ScrollingDivTestCase
.prototype.setUp
= function() {
11 "<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n" +
12 "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n" +
13 "quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n" +
14 "consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n" +
15 "cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n" +
16 "non proident, sunt in culpa qui officia deserunt mollit anim id est\n" +
19 document
.body
.innerHTML
=
20 "<div id='scroller' style='overflow: scroll; height: 450px; width: 800px;'>" +
21 "<div id='graph'></div>" +
22 "<div style='height:100px; background-color:green;'>" + LOREM_IPSUM
+ " </div>" +
23 "<div style='height:100px; background-color:red;'>" + LOREM_IPSUM
+ "</div>" +
36 var graph
= document
.getElementById("graph");
40 this.g
= new Dygraph(graph
, data
,
44 highlightCircleSize
: 6,
45 pointClickCallback
: function(evt
, point
) {
53 ScrollingDivTestCase
.prototype.tearDown
= function() {
57 * This tests that when the nested div is unscrolled, things work normally.
59 ScrollingDivTestCase
.prototype.testUnscrolledDiv
= function() {
61 document
.getElementById('scroller').scrollTop
= 0;
70 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousemove' }));
71 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousedown' }));
72 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mouseup' }));
74 assertEquals(40, this.point
.xval
);
75 assertEquals(4, this.point
.yval
);
79 * This tests that when the nested div is scrolled, things work normally.
81 ScrollingDivTestCase
.prototype.testScrolledDiv
= function() {
82 document
.getElementById('scroller').scrollTop
= 117;
91 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousemove' }));
92 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousedown' }));
93 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mouseup' }));
95 assertEquals(40, this.point
.xval
);
96 assertEquals(4, this.point
.yval
);