Define _matchMedia wrapper earlier
The unit test stub didn't work because the _matchMedia wrapper was defined too late. This fix defines it earlier.
This commit is contained in:
parent
cc6c152984
commit
67b8cfedf9
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue