@@ -52,7 +52,10 @@ describe('GoogleMap', () => {
5252 const container = fixture . debugElement . query ( By . css ( 'div' ) ) ! ;
5353 expect ( container . nativeElement . style . height ) . toBe ( DEFAULT_HEIGHT ) ;
5454 expect ( container . nativeElement . style . width ) . toBe ( DEFAULT_WIDTH ) ;
55- expect ( mapConstructorSpy ) . toHaveBeenCalledWith ( container . nativeElement , DEFAULT_OPTIONS ) ;
55+ expect ( mapConstructorSpy ) . toHaveBeenCalledWith ( container . nativeElement , {
56+ ...DEFAULT_OPTIONS ,
57+ mapId : undefined ,
58+ } ) ;
5659 } ) ;
5760
5861 it ( 'sets height and width of the map' , ( ) => {
@@ -67,7 +70,10 @@ describe('GoogleMap', () => {
6770 const container = fixture . debugElement . query ( By . css ( 'div' ) ) ! ;
6871 expect ( container . nativeElement . style . height ) . toBe ( '750px' ) ;
6972 expect ( container . nativeElement . style . width ) . toBe ( '400px' ) ;
70- expect ( mapConstructorSpy ) . toHaveBeenCalledWith ( container . nativeElement , DEFAULT_OPTIONS ) ;
73+ expect ( mapConstructorSpy ) . toHaveBeenCalledWith ( container . nativeElement , {
74+ ...DEFAULT_OPTIONS ,
75+ mapId : undefined ,
76+ } ) ;
7177
7278 fixture . componentInstance . height = '650px' ;
7379 fixture . componentInstance . width = '350px' ;
@@ -118,6 +124,7 @@ describe('GoogleMap', () => {
118124 center : { lat : 3 , lng : 5 } ,
119125 zoom : 7 ,
120126 mapTypeId : DEFAULT_OPTIONS . mapTypeId ,
127+ mapId : undefined ,
121128 } ;
122129 mapSpy = createMapSpy ( options ) ;
123130 mapConstructorSpy = createMapConstructorSpy ( mapSpy ) ;
@@ -344,6 +351,20 @@ describe('GoogleMap', () => {
344351 expect ( mapSpy . setMapTypeId ) . toHaveBeenCalledWith ( 'roadmap' ) ;
345352 } ) ;
346353
354+ it ( 'should set the map ID' , ( ) => {
355+ mapSpy = createMapSpy ( DEFAULT_OPTIONS ) ;
356+ mapConstructorSpy = createMapConstructorSpy ( mapSpy ) ;
357+
358+ const fixture = TestBed . createComponent ( TestApp ) ;
359+ fixture . componentInstance . mapId = '123' ;
360+ fixture . detectChanges ( ) ;
361+
362+ expect ( mapConstructorSpy ) . toHaveBeenCalledWith (
363+ jasmine . any ( HTMLElement ) ,
364+ jasmine . objectContaining ( { mapId : '123' } ) ,
365+ ) ;
366+ } ) ;
367+
347368 it ( 'sets mapTypeId through the options' , ( ) => {
348369 const options = { mapTypeId : 'satellite' } ;
349370 mapSpy = createMapSpy ( options ) ;
@@ -401,6 +422,7 @@ describe('GoogleMap', () => {
401422 [zoom]="zoom"
402423 [options]="options"
403424 [mapTypeId]="mapTypeId"
425+ [mapId]="mapId"
404426 (mapClick)="handleClick($event)"
405427 (centerChanged)="handleCenterChanged()"
406428 (mapRightclick)="handleRightclick($event)"
@@ -417,6 +439,7 @@ class TestApp {
417439 zoom ?: number ;
418440 options ?: google . maps . MapOptions ;
419441 mapTypeId ?: google . maps . MapTypeId ;
442+ mapId ?: string ;
420443
421444 handleClick ( event : google . maps . MapMouseEvent ) { }
422445 handleCenterChanged ( ) { }
0 commit comments