projects
/
dygraphs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #576 from mjanda/master
[dygraphs.git]
/
auto_tests
/
tests
/
hidpi.js
diff --git
a/auto_tests/tests/hidpi.js
b/auto_tests/tests/hidpi.js
index
17a75a0
..
cdf0ee4
100644
(file)
--- a/
auto_tests/tests/hidpi.js
+++ b/
auto_tests/tests/hidpi.js
@@
-3,21
+3,24
@@
*
* @author danvdk@gmail.com (Dan Vanderkam)
*/
*
* @author danvdk@gmail.com (Dan Vanderkam)
*/
-var hidpiTestCase = TestCase("hidpi");
+describe("hidpi", function() {
var savePixelRatio;
var savePixelRatio;
-
hidpiTestCase.prototype.setUp =
function() {
+
beforeEach(
function() {
savePixelRatio = window.devicePixelRatio;
window.devicePixelRatio = 2;
document.body.innerHTML = "<div id='graph'></div>";
savePixelRatio = window.devicePixelRatio;
window.devicePixelRatio = 2;
document.body.innerHTML = "<div id='graph'></div>";
-};
+}
)
;
-
hidpiTestCase.prototype.tearDown =
function() {
+
afterEach(
function() {
window.devicePixelRatio = savePixelRatio;
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";
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);
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
// 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);
+});
+
+});