@@ -122,7 +122,7 @@ describe('GoogleMap', () => {
122122 } ) ;
123123
124124 it ( 'sets center and zoom of the map' , ( ) => {
125- const options = { center : { lat : 3 , lng : 5 } , zoom : 7 } ;
125+ const options = { center : { lat : 3 , lng : 5 } , zoom : 7 , mapTypeId : undefined } ;
126126 mapSpy = createMapSpy ( options ) ;
127127 mapConstructorSpy = createMapConstructorSpy ( mapSpy ) . and . callThrough ( ) ;
128128
@@ -143,7 +143,7 @@ describe('GoogleMap', () => {
143143 } ) ;
144144
145145 it ( 'sets map options' , ( ) => {
146- const options = { center : { lat : 3 , lng : 5 } , zoom : 7 , draggable : false } ;
146+ const options = { center : { lat : 3 , lng : 5 } , zoom : 7 , draggable : false , mapTypeId : undefined } ;
147147 mapSpy = createMapSpy ( options ) ;
148148 mapConstructorSpy = createMapConstructorSpy ( mapSpy ) . and . callThrough ( ) ;
149149
@@ -162,7 +162,12 @@ describe('GoogleMap', () => {
162162
163163 it ( 'gives precedence to center and zoom over options' , ( ) => {
164164 const inputOptions = { center : { lat : 3 , lng : 5 } , zoom : 7 , heading : 170 } ;
165- const correctedOptions = { center : { lat : 12 , lng : 15 } , zoom : 5 , heading : 170 } ;
165+ const correctedOptions = {
166+ center : { lat : 12 , lng : 15 } ,
167+ zoom : 5 ,
168+ heading : 170 ,
169+ mapTypeId : undefined
170+ } ;
166171 mapSpy = createMapSpy ( correctedOptions ) ;
167172 mapConstructorSpy = createMapConstructorSpy ( mapSpy ) ;
168173
@@ -280,6 +285,23 @@ describe('GoogleMap', () => {
280285 expect ( addSpy ) . toHaveBeenCalledWith ( 'projection_changed' , jasmine . any ( Function ) ) ;
281286 subscription . unsubscribe ( ) ;
282287 } ) ;
288+
289+ it ( 'should set the map type' , ( ) => {
290+ mapSpy = createMapSpy ( DEFAULT_OPTIONS ) ;
291+ mapConstructorSpy = createMapConstructorSpy ( mapSpy ) . and . callThrough ( ) ;
292+
293+ const fixture = TestBed . createComponent ( TestApp ) ;
294+ fixture . componentInstance . mapTypeId = 'terrain' as unknown as google . maps . MapTypeId ;
295+ fixture . detectChanges ( ) ;
296+
297+ expect ( mapConstructorSpy ) . toHaveBeenCalledWith ( jasmine . any ( HTMLElement ) ,
298+ jasmine . objectContaining ( { mapTypeId : 'terrain' } ) ) ;
299+
300+ fixture . componentInstance . mapTypeId = 'roadmap' as unknown as google . maps . MapTypeId ;
301+ fixture . detectChanges ( ) ;
302+
303+ expect ( mapSpy . setMapTypeId ) . toHaveBeenCalledWith ( 'roadmap' ) ;
304+ } ) ;
283305} ) ;
284306
285307@Component ( {
@@ -289,6 +311,7 @@ describe('GoogleMap', () => {
289311 [center]="center"
290312 [zoom]="zoom"
291313 [options]="options"
314+ [mapTypeId]="mapTypeId"
292315 (mapClick)="handleClick($event)"
293316 (centerChanged)="handleCenterChanged()"
294317 (mapRightclick)="handleRightclick($event)">
@@ -301,6 +324,7 @@ class TestApp {
301324 center ?: google . maps . LatLngLiteral ;
302325 zoom ?: number ;
303326 options ?: google . maps . MapOptions ;
327+ mapTypeId ?: google . maps . MapTypeId ;
304328
305329 handleClick ( event : google . maps . MouseEvent ) { }
306330 handleCenterChanged ( ) { }
0 commit comments