Skip to content

Commit

Permalink
allowing use of all 3 icon styles
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDanger authored and brianjlandau committed Jul 11, 2010
1 parent a56ef9e commit 8fcbed1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions jquery.jmapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,17 @@ if (GMap2){
return {};
}
};

var createMarker = function(place_elm){
var $place_elm = $(place_elm), place_data, point, marker, $info_window_elm;

place_data = $place_elm.metadata(settings.metadata_options);
point = $.jMapping.makeGLatLng(place_data.point);
if (settings.category_icon_options){
var custom_icon = MapIconMaker.createMarkerIcon(chooseIconOptions(place_data.category));
var icon_options = chooseIconOptions(place_data.category)
if(!icon_options.style) icon_options.style = 'Marker'

var custom_icon = MapIconMaker['create'+icon_options.style+'Icon'](icon_options);
marker = new GMarker(point, {icon: custom_icon});
} else {
marker = new GMarker(point);
Expand Down
18 changes: 9 additions & 9 deletions spec/jmapping_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,18 @@ Screw.Unit(function(){
$('ul#map-item-list li.location .info-html').each(function(){
marker_mock.should_receive('bindInfoWindowHtml').exactly('once').with_arguments($(this).html(), {maxWidth: 380});
});

mockGMaps(marker_mock);
mockMarkerManager();

// mock out Icon
MapIconMaker = mock();
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#CC0000'});
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#33FFFF'});
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#CC0000', style: 'Marker'});
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#33FFFF', style: 'Marker'});

$('#map').jMapping({
side_bar_selector: 'ul#map-item-list',
location_selector: 'li.location',
side_bar_selector: 'ul#map-item-list',
location_selector: 'li.location',
link_selector: 'a.map-item',
info_window_selector: '.info-html',
info_window_max_width: 380,
Expand Down Expand Up @@ -399,8 +399,8 @@ Screw.Unit(function(){

// mock out Icon
MapIconMaker = mock();
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#CC0000'});
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#33FFFF'});
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#CC0000', style: 'Marker'});
MapIconMaker.should_receive('createMarkerIcon').exactly('once').with_arguments({primaryColor: '#33FFFF', style: 'Marker'});

category_function = mock_function(function(category){
if (category.charAt(0).match(/[a-m]/i)){
Expand Down

0 comments on commit 8fcbed1

Please sign in to comment.