X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fhidpi.js;h=cdf0ee4809a4fe37a4650916673b16d32c1afd58;hb=6b875aecfcde4309fc2db816e5b29c75affdad54;hp=17a75a01dc0c81e43b12447621bc06977ffc7cf2;hpb=88bbada8ddcef3861b258b865be65ab579efbcfb;p=dygraphs.git diff --git a/auto_tests/tests/hidpi.js b/auto_tests/tests/hidpi.js index 17a75a0..cdf0ee4 100644 --- a/auto_tests/tests/hidpi.js +++ b/auto_tests/tests/hidpi.js @@ -3,21 +3,24 @@ * * @author danvdk@gmail.com (Dan Vanderkam) */ -var hidpiTestCase = TestCase("hidpi"); +describe("hidpi", function() { var savePixelRatio; -hidpiTestCase.prototype.setUp = function() { +beforeEach(function() { savePixelRatio = window.devicePixelRatio; window.devicePixelRatio = 2; document.body.innerHTML = "
"; -}; +}); -hidpiTestCase.prototype.tearDown = function() { +afterEach(function() { window.devicePixelRatio = savePixelRatio; -}; +}); + +it('testDoesntCreateScrollbars', function() { + var sw = document.body.scrollWidth; + var cw = document.body.clientWidth; -hidpiTestCase.prototype.testNameGoesHere = function() { var graph = document.getElementById("graph"); graph.style.width = "70%"; // more than half. graph.style.height = "200px"; @@ -32,8 +35,12 @@ 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); -}; + assert.equal(cw, document.body.clientWidth); + assert.equal(sw, document.body.scrollWidth); +}); + +});