Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created July 10, 2015 02:25
Show Gist options
  • Save tmcw/eeb1a3d066f005ad32e9 to your computer and use it in GitHub Desktop.
Save tmcw/eeb1a3d066f005ad32e9 to your computer and use it in GitHub Desktop.
Mapbox GL Mock
/**
* Mocking fake map for testing
*/
function MapboxGLMockMap() {
this.style = {
getLayer: function() { },
removeLayer: function() { }
};
this.transform = {
bearing: 0,
center: { lat: 0, lng: 0 },
zoom: 0
};
}
MapboxGLMockMap.prototype.on = function() { return this; };
MapboxGLMockMap.prototype.off = function() { return this; };
MapboxGLMockMap.prototype.remove = function() { return this; };
MapboxGLMockMap.prototype.resize = function() { return this; };
MapboxGLMockMap.prototype.setLayoutProperty = function() { };
MapboxGLMockMap.prototype.setPaintProperty = function() { };
MapboxGLMockMap.prototype.setStyle = function() { };
MapboxGLMockMap.prototype.setView = function() { };
MapboxGLMockMap.prototype.getBearing = function() { return 0; };
MapboxGLMockMap.prototype.getCenter = function() { return { lat: 0, lng: 0 }; };
MapboxGLMockMap.prototype.featuresAt = function(point, opts, cb) {
cb([]);
};
module.exports.Map = MapboxGLMockMap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment