From: Paul Holden Date: Mon, 25 Aug 2014 01:58:19 +0000 (-0400) Subject: Update the hidpi test to work on a wider variety of platforms (e.g. when running... X-Git-Tag: v1.1.0~49^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=5fc893534031ff443e00b94325fdfc007274f99a;p=dygraphs.git Update the hidpi test to work on a wider variety of platforms (e.g. when running the tests via `java -jar ./auto_tests/lib/JsTestDriver-1.3.3c.jar --tests all`) --- 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); };