@@ -63,7 +63,7 @@ describe('ClusterManager', () => {
63
63
} ) ) ;
64
64
} ) ;
65
65
66
- describe ( 'set marker icon' , ( ) => {
66
+ describe ( 'set url marker icon' , ( ) => {
67
67
it ( 'should update that marker via setIcon method when the markerUrl changes' ,
68
68
async ( inject (
69
69
[ ClusterManager , GoogleMapsAPIWrapper ] ,
@@ -88,13 +88,52 @@ describe('ClusterManager', () => {
88
88
title : undefined ,
89
89
clickable : true
90
90
} , false ) ;
91
- const iconUrl = 'http://angular-maps.com/icon.png' ;
92
- newMarker . iconUrl = iconUrl ;
91
+ const url = 'http://angular-maps.com/icon.png' ;
92
+ newMarker . icon = url ;
93
93
return markerManager . updateIcon ( newMarker ) . then (
94
- ( ) => { expect ( markerInstance . setIcon ) . toHaveBeenCalledWith ( iconUrl ) ; } ) ;
94
+ ( ) => { expect ( markerInstance . setIcon ) . toHaveBeenCalledWith ( url ) ; } ) ;
95
95
} ) ) ) ;
96
96
} ) ;
97
97
98
+ describe ( 'set complex marker icon' , ( ) => {
99
+ it ( 'should update that marker via setIcon method when the markerUrl changes' ,
100
+ async ( inject (
101
+ [ ClusterManager , GoogleMapsAPIWrapper ] ,
102
+ ( markerManager : ClusterManager , apiWrapper : GoogleMapsAPIWrapper ) => {
103
+ const newMarker = new AgmMarker ( markerManager ) ;
104
+ newMarker . latitude = 34.4 ;
105
+ newMarker . longitude = 22.3 ;
106
+ newMarker . label = 'A' ;
107
+
108
+ const markerInstance : Marker = jasmine . createSpyObj ( 'Marker' , [ 'setMap' , 'setIcon' ] ) ;
109
+ ( < any > apiWrapper . createMarker ) . and . returnValue ( Promise . resolve ( markerInstance ) ) ;
110
+
111
+ markerManager . addMarker ( newMarker ) ;
112
+ expect ( apiWrapper . createMarker ) . toHaveBeenCalledWith ( {
113
+ position : { lat : 34.4 , lng : 22.3 } ,
114
+ label : 'A' ,
115
+ draggable : false ,
116
+ icon : undefined ,
117
+ opacity : 1 ,
118
+ visible : true ,
119
+ zIndex : 1 ,
120
+ title : undefined ,
121
+ clickable : true
122
+ } , false ) ;
123
+ const icon = {
124
+ anchor : { x : 16 , y : 16 } ,
125
+ labelOrigin : { x : 0 , y : 0 } ,
126
+ origin : { x : 0 , y : 0 } ,
127
+ scaledSize : { height : 32 , width : 32 } ,
128
+ size : { height : 32 , width : 32 } ,
129
+ url : 'http://angular-maps.com/icon.png'
130
+ } ;
131
+ newMarker . icon = icon ;
132
+ return markerManager . updateIcon ( newMarker ) . then (
133
+ ( ) => { expect ( markerInstance . setIcon ) . toHaveBeenCalledWith ( icon ) ; } ) ;
134
+ } ) ) ) ;
135
+ } ) ;
136
+
98
137
describe ( 'set marker opacity' , ( ) => {
99
138
it ( 'should update that marker via setOpacity method when the markerOpacity changes' ,
100
139
async ( inject (
0 commit comments