X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fhidpi.js;h=c595065fb58d5b8064e9a6ca4459dad3a86afaa0;hb=0a0885d1383321a67155fcf1cb12c583cdd89ef2;hp=17a75a01dc0c81e43b12447621bc06977ffc7cf2;hpb=cb8bb6a6a93ecdb6f4cad42b575e3522c9b4b37e;p=dygraphs.git diff --git a/auto_tests/tests/hidpi.js b/auto_tests/tests/hidpi.js index 17a75a0..c595065 100644 --- a/auto_tests/tests/hidpi.js +++ b/auto_tests/tests/hidpi.js @@ -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"; @@ -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); };