Created
March 8, 2012 16:01
-
-
Save stevehorn/2001697 to your computer and use it in GitHub Desktop.
Spy Confusion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Want to use this test setup | |
describe("Topography Controls", function () { | |
beforeEach(function () { | |
loadFixtures("NFocusMap.html"); | |
this.dummyMap = new GoogleMapWrapper(null); | |
spyOn(this.dummyMap, 'addControlsRightTop'); | |
spyOn(this.dummyMap, 'setOverlay'); | |
this.classUnderTest = new ClassUnderTest(this.dummyMap); | |
}); | |
}); | |
var GoogleMapWrapper = function (map) { | |
var self = this; | |
self.map = map; | |
var initializeGoogleMap = function () { | |
//Throws because jquery is not defined | |
$.each(nmap.TileTypes, function (key, type) { | |
map.overlayMapTypes.push(null); | |
}); | |
}; | |
self.addControlsRightTop = function (controlsToAdd) { | |
map.controls[google.maps.ControlPosition.RIGHT_TOP].push(controlsToAdd); | |
}; | |
self.setOverlay = function (imageMapTypeOptions, position) { | |
var carrierRouteImageMapType = new google.maps.ImageMapType(imageMapTypeOptions); | |
map.overlayMapTypes.setAt(position, carrierRouteImageMapType); | |
}; | |
initializeGoogleMap(); | |
}; | |
//Hacked workaround | |
var GoogleMapWrapper = function (initialize, map) { | |
var self = this; | |
self.map = map; | |
var initializeGoogleMap = function () { | |
$.each(nmap.TileTypes, function (key, type) { | |
map.overlayMapTypes.push(null); | |
}); | |
}; | |
self.addControlsRightTop = function (controlsToAdd) { | |
map.controls[google.maps.ControlPosition.RIGHT_TOP].push(controlsToAdd); | |
}; | |
self.setOverlay = function (imageMapTypeOptions, position) { | |
var carrierRouteImageMapType = new google.maps.ImageMapType(imageMapTypeOptions); | |
map.overlayMapTypes.setAt(position, carrierRouteImageMapType); | |
}; | |
//Hack - only initialize if this isn't test mode: | |
if(initialize) { | |
initializeGoogleMap(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment