Skip to content

Commit

Permalink
Merge pull request danvk#309 from hulkholden/hidpi
Browse files Browse the repository at this point in the history
Update the hidpi test to work on a wider variety of platforms
  • Loading branch information
kberg committed Aug 25, 2014
2 parents d037a49 + 5fc8935 commit 99386b9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions auto_tests/tests/hidpi.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ hidpiTestCase.prototype.tearDown = function() {
window.devicePixelRatio = savePixelRatio;
};

hidpiTestCase.prototype.testNameGoesHere = function() {
hidpiTestCase.prototype.testDoesntCreateScrollbars = function() {
var sw = document.body.scrollWidth;
var cw = document.body.clientWidth;

var graph = document.getElementById("graph");
graph.style.width = "70%"; // more than half.
graph.style.height = "200px";
Expand All @@ -32,8 +35,10 @@ hidpiTestCase.prototype.testNameGoesHere = function() {

var g = new Dygraph(graph, data, opts);

// Adding the graph shouldn't cause the width of the page to change.
// (essentially, we're checking that we don't end up with a scrollbar)
// See http://stackoverflow.com/a/2146905/388951
var hasHorizontalScrollbar = (document.body.scrollWidth > document.body.clientWidth);
assertEquals(false, hasHorizontalScrollbar);
assertEquals(cw, document.body.clientWidth);
assertEquals(sw, document.body.scrollWidth);
};

0 comments on commit 99386b9

Please sign in to comment.