2 * @fileoverview Tests for window.devicePixelRatio > 1.
4 * @author danvdk@gmail.com (Dan Vanderkam)
6 describe("hidpi", function() {
9 beforeEach(function() {
10 savePixelRatio
= window
.devicePixelRatio
;
11 window
.devicePixelRatio
= 2;
13 document
.body
.innerHTML
= "<div id='graph'></div>";
16 afterEach(function() {
17 window
.devicePixelRatio
= savePixelRatio
;
20 it('testDoesntCreateScrollbars', function() {
21 var sw
= document
.body
.scrollWidth
;
22 var cw
= document
.body
.clientWidth
;
24 var graph
= document
.getElementById("graph");
25 graph
.style
.width
= "70%"; // more than half.
26 graph
.style
.height
= "200px";
36 var g
= new Dygraph(graph
, data
, opts
);
38 // Adding the graph shouldn't cause the width of the page to change.
39 // (essentially, we're checking that we don't end up with a scrollbar)
40 // See http://stackoverflow.com/a/2146905/388951
41 assert
.equal(cw
, document
.body
.clientWidth
);
42 assert
.equal(sw
, document
.body
.scrollWidth
);