summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-03-18 16:02:13 +0100
committerVincent Petry <pvince81@owncloud.com>2014-03-18 16:02:13 +0100
commit67b8cfedf9f500eb25871265a05c874acc4809ff (patch)
tree3e477e465f7052e27b3354b6723f26cbf7448d08 /core
parentcc6c1529848022765b9be6be808cf4dfb5b2d029 (diff)
downloadnextcloud-server-67b8cfedf9f500eb25871265a05c874acc4809ff.tar.gz
nextcloud-server-67b8cfedf9f500eb25871265a05c874acc4809ff.zip
Define _matchMedia wrapper earlier
The unit test stub didn't work because the _matchMedia wrapper was defined too late. This fix defines it earlier.
Diffstat (limited to 'core')
-rw-r--r--core/js/js.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 87b2d59f160..121a4062d37 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -516,6 +516,19 @@ var OC={
}
$toggle.off('click.menu').removeClass('menutoggle');
$menuEl.removeClass('menu');
+ },
+
+ /**
+ * Wrapper for matchMedia
+ *
+ * This is makes it possible for unit tests to
+ * stub matchMedia (which doesn't work in PhantomJS)
+ */
+ _matchMedia: function(media) {
+ if (window.matchMedia) {
+ return window.matchMedia(media);
+ }
+ return false;
}
};
OC.search.customResults={};
@@ -1033,10 +1046,6 @@ function initCore() {
}
if (window.matchMedia) {
- // wrapper needed for unit tests due to PhantomJS bugs
- OC._matchMedia = function(media) {
- return window.matchMedia(media);
- }
setupMainMenu();
}
}