forked from danvk/dygraphs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request danvk#303 from danvk/fix-hidpi
Fix HiDPI over-scrolling issue
- Loading branch information
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @fileoverview Tests for window.devicePixelRatio > 1. | ||
* | ||
* @author [email protected] (Dan Vanderkam) | ||
*/ | ||
var hidpiTestCase = TestCase("hidpi"); | ||
|
||
var savePixelRatio; | ||
hidpiTestCase.prototype.setUp = function() { | ||
savePixelRatio = window.devicePixelRatio; | ||
window.devicePixelRatio = 2; | ||
|
||
document.body.innerHTML = "<div id='graph'></div>"; | ||
}; | ||
|
||
hidpiTestCase.prototype.tearDown = function() { | ||
window.devicePixelRatio = savePixelRatio; | ||
}; | ||
|
||
hidpiTestCase.prototype.testNameGoesHere = function() { | ||
var graph = document.getElementById("graph"); | ||
graph.style.width = "70%"; // more than half. | ||
graph.style.height = "200px"; | ||
|
||
var opts = {}; | ||
var data = "X,Y\n" + | ||
"0,-1\n" + | ||
"1,0\n" + | ||
"2,1\n" + | ||
"3,0\n" | ||
; | ||
|
||
var g = new Dygraph(graph, data, opts); | ||
|
||
// See http://stackoverflow.com/a/2146905/388951 | ||
var hasHorizontalScrollbar = (document.body.scrollWidth > document.body.clientWidth); | ||
assertEquals(false, hasHorizontalScrollbar); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters