projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make constructor a pure forward to __init__.
[dygraphs.git]
/
auto_tests
/
tests
/
scrolling_div.js
diff --git
a/auto_tests/tests/scrolling_div.js
b/auto_tests/tests/scrolling_div.js
index
8fa950e
..
ce95a7e
100644
(file)
--- a/
auto_tests/tests/scrolling_div.js
+++ b/
auto_tests/tests/scrolling_div.js
@@
-3,9
+3,11
@@
*
* @author konigsberg@google.com (Robert Konigsbrg)
*/
*
* @author konigsberg@google.com (Robert Konigsbrg)
*/
-var ScrollingDivTestCase = TestCase("scrolling-div");
+describe("scrolling-div", function() {
-ScrollingDivTestCase.prototype.setUp = function() {
+var point, g;
+
+beforeEach(function() {
var LOREM_IPSUM =
"<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n" +
var LOREM_IPSUM =
"<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n" +
@@
-35,29
+37,25
@@
var LOREM_IPSUM =
var graph = document.getElementById("graph");
var graph = document.getElementById("graph");
- this.point = null;
- var self = this;
- this.g = new Dygraph(graph, data,
+ point = null;
+ g = new Dygraph(graph, data,
{
labels : ['a', 'b'],
drawPoints : true,
highlightCircleSize : 6,
{
labels : ['a', 'b'],
drawPoints : true,
highlightCircleSize : 6,
- pointClickCallback : function(evt, point) {
- // chrome sez: 243 30 248 124, scroller.offsetLeft/Top = 8/8
- // ff sez: 245 17 249 126, " "
- console.log(evt.clientX, evt.clientY, evt.screenX, evt.screenY);
- self.point = point;
+ pointClickCallback : function(evt, p) {
+ point = p;
}
}
);
}
}
);
-};
+}
)
;
// This is usually something like 15, but for OS X Lion and its auto-hiding
// scrollbars, it's 0. This is a large enough difference that we need to
// consider it when synthesizing clicks.
// Adapted from http://davidwalsh.name/detect-scrollbar-width
// This is usually something like 15, but for OS X Lion and its auto-hiding
// scrollbars, it's 0. This is a large enough difference that we need to
// consider it when synthesizing clicks.
// Adapted from http://davidwalsh.name/detect-scrollbar-width
-
ScrollingDivTestCase.prototype.
detectScrollbarWidth = function() {
+
var
detectScrollbarWidth = function() {
// Create the measurement node
var scrollDiv = document.createElement("div");
scrollDiv.style.width = "100px";
// Create the measurement node
var scrollDiv = document.createElement("div");
scrollDiv.style.width = "100px";
@@
-76,13
+74,13
@@
ScrollingDivTestCase.prototype.detectScrollbarWidth = function() {
return scrollbarWidth;
};
return scrollbarWidth;
};
-
ScrollingDivTestCase.prototype.tearDown =
function() {
-};
+
afterEach(
function() {
+}
)
;
/**
* This tests that when the nested div is unscrolled, things work normally.
*/
/**
* This tests that when the nested div is unscrolled, things work normally.
*/
-
ScrollingDivTestCase.prototype.testUnscrolledDiv =
function() {
+
it('testUnscrolledDiv',
function() {
document.getElementById('scroller').scrollTop = 0;
document.getElementById('scroller').scrollTop = 0;
@@
-93,31
+91,33
@@
ScrollingDivTestCase.prototype.testUnscrolledDiv = function() {
screenY: 320
};
screenY: 320
};
- DygraphOps.dispatchCanvasEvent(
this.
g, DygraphOps.createEvent(clickOn4_40, { type : 'mousemove' }));
- DygraphOps.dispatchCanvasEvent(
this.
g, DygraphOps.createEvent(clickOn4_40, { type : 'mousedown' }));
- DygraphOps.dispatchCanvasEvent(
this.
g, DygraphOps.createEvent(clickOn4_40, { type : 'mouseup' }));
+ DygraphOps.dispatchCanvasEvent(g, DygraphOps.createEvent(clickOn4_40, { type : 'mousemove' }));
+ DygraphOps.dispatchCanvasEvent(g, DygraphOps.createEvent(clickOn4_40, { type : 'mousedown' }));
+ DygraphOps.dispatchCanvasEvent(g, DygraphOps.createEvent(clickOn4_40, { type : 'mouseup' }));
- assert
Equals(40, this.
point.xval);
- assert
Equals(4, this.
point.yval);
-};
+ assert
.equal(40,
point.xval);
+ assert
.equal(4,
point.yval);
+}
)
;
/**
* This tests that when the nested div is scrolled, things work normally.
*/
/**
* This tests that when the nested div is scrolled, things work normally.
*/
-
ScrollingDivTestCase.prototype.testScrolledDiv =
function() {
+
it('testScrolledDiv',
function() {
document.getElementById('scroller').scrollTop = 117;
var clickOn4_40 = {
clientX: 244,
document.getElementById('scroller').scrollTop = 117;
var clickOn4_40 = {
clientX: 244,
- clientY: 30 -
this.
detectScrollbarWidth(),
+ clientY: 30 - detectScrollbarWidth(),
screenX: 416,
screenY: 160
};
screenX: 416,
screenY: 160
};
- DygraphOps.dispatchCanvasEvent(
this.
g, DygraphOps.createEvent(clickOn4_40, { type : 'mousemove' }));
- DygraphOps.dispatchCanvasEvent(
this.
g, DygraphOps.createEvent(clickOn4_40, { type : 'mousedown' }));
- DygraphOps.dispatchCanvasEvent(
this.
g, DygraphOps.createEvent(clickOn4_40, { type : 'mouseup' }));
+ DygraphOps.dispatchCanvasEvent(g, DygraphOps.createEvent(clickOn4_40, { type : 'mousemove' }));
+ DygraphOps.dispatchCanvasEvent(g, DygraphOps.createEvent(clickOn4_40, { type : 'mousedown' }));
+ DygraphOps.dispatchCanvasEvent(g, DygraphOps.createEvent(clickOn4_40, { type : 'mouseup' }));
- assertEquals(40, this.point.xval);
- assertEquals(4, this.point.yval);
-};
+ assert.equal(40, point.xval);
+ assert.equal(4, point.yval);
+});
+
+});