2 * @fileoverview Tests for window.devicePixelRatio > 1.
4 * @author danvdk@gmail.com (Dan Vanderkam)
7 import Dygraph from
'../../src/dygraph';
9 describe("hidpi", function() {
14 beforeEach(function() {
15 savePixelRatio
= window
.devicePixelRatio
;
16 window
.devicePixelRatio
= 2;
19 afterEach(function() {
20 window
.devicePixelRatio
= savePixelRatio
;
23 it('testDoesntCreateScrollbars', function() {
24 var sw
= document
.body
.scrollWidth
;
25 var cw
= document
.body
.clientWidth
;
27 var graph
= document
.getElementById("graph");
28 graph
.style
.width
= "70%"; // more than half.
29 graph
.style
.height
= "200px";
39 var g
= new Dygraph(graph
, data
, opts
);
41 // Adding the graph shouldn't cause the width of the page to change.
42 // (essentially, we're checking that we don't end up with a scrollbar)
43 // See http://stackoverflow.com/a/2146905/388951
44 assert
.equal(cw
, document
.body
.clientWidth
);
45 assert
.equal(sw
, document
.body
.scrollWidth
);