Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Refactor browser utilities to be testable

Jo Sprague66fc56b1429d
diff --git a/web/js/util/browser.js b/web/js/util/browser.js
index 090a38bb4..983d56d01 100644
--- a/web/js/util/browser.js
+++ b/web/js/util/browser.js
@@ -194,13 +194,15 @@ export default (function () {
};
self.tests.small = function () {
- return $(window)
- .width() < self.mobileWidth;
+ return self.tests.getWindowDimensions()[0] < self.mobileWidth;
+ };
+
+ self.tests.getWindowDimensions = function () {
+ return [$(window).width(), $(window).height()];
};
self.tests.constrained = function () {
- return $(window)
- .height() < self.constrainedHeight;
+ return self.tests.getWindowDimensions()[1] < self.constrainedHeight;
};
self.tests.history = function () {