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 style='overflow: scroll; height: 450px; width: 800px;'>" +
21 "<a name='TOP'></a><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>" +
24 "<a name='BOTTOM'></a>" +
37 var graph
= document
.getElementById("graph");
41 this.g
= new Dygraph(graph
, data
,
45 highlightCircleSize
: 6,
46 pointClickCallback
: function(evt
, point
) {
54 ScrollingDivTestCase
.prototype.tearDown
= function() {
58 * This tests that when the nested div is unscrolled, things work normally.
60 ScrollingDivTestCase
.prototype.testUnscrolledDiv
= function() {
62 window
.location
.href
="#TOP";
71 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousemove' }));
72 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousedown' }));
73 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mouseup' }));
75 assertEquals(40, this.point
.xval
);
76 assertEquals(4, this.point
.yval
);
80 * This tests that when the nested div is scrolled, things work normally.
82 ScrollingDivTestCase
.prototype.testScrolledDiv
= function() {
83 window
.location
.href
="#BOTTOM";
92 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousemove' }));
93 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mousedown' }));
94 DygraphOps
.dispatchCanvasEvent(this.g
, DygraphOps
.createEvent(clickOn4_40
, { type
: 'mouseup' }));
96 assertEquals(40, this.point
.xval
);
97 assertEquals(4, this.point
.yval
);