@@ -52,7 +52,10 @@ describe('GoogleMap', () => {
52
52
const container = fixture . debugElement . query ( By . css ( 'div' ) ) ! ;
53
53
expect ( container . nativeElement . style . height ) . toBe ( DEFAULT_HEIGHT ) ;
54
54
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
+ } ) ;
56
59
} ) ;
57
60
58
61
it ( 'sets height and width of the map' , ( ) => {
@@ -67,7 +70,10 @@ describe('GoogleMap', () => {
67
70
const container = fixture . debugElement . query ( By . css ( 'div' ) ) ! ;
68
71
expect ( container . nativeElement . style . height ) . toBe ( '750px' ) ;
69
72
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
+ } ) ;
71
77
72
78
fixture . componentInstance . height = '650px' ;
73
79
fixture . componentInstance . width = '350px' ;
@@ -118,6 +124,7 @@ describe('GoogleMap', () => {
118
124
center : { lat : 3 , lng : 5 } ,
119
125
zoom : 7 ,
120
126
mapTypeId : DEFAULT_OPTIONS . mapTypeId ,
127
+ mapId : undefined ,
121
128
} ;
122
129
mapSpy = createMapSpy ( options ) ;
123
130
mapConstructorSpy = createMapConstructorSpy ( mapSpy ) ;
@@ -344,6 +351,20 @@ describe('GoogleMap', () => {
344
351
expect ( mapSpy . setMapTypeId ) . toHaveBeenCalledWith ( 'roadmap' ) ;
345
352
} ) ;
346
353
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
+
347
368
it ( 'sets mapTypeId through the options' , ( ) => {
348
369
const options = { mapTypeId : 'satellite' } ;
349
370
mapSpy = createMapSpy ( options ) ;
@@ -401,6 +422,7 @@ describe('GoogleMap', () => {
401
422
[zoom]="zoom"
402
423
[options]="options"
403
424
[mapTypeId]="mapTypeId"
425
+ [mapId]="mapId"
404
426
(mapClick)="handleClick($event)"
405
427
(centerChanged)="handleCenterChanged()"
406
428
(mapRightclick)="handleRightclick($event)"
@@ -417,6 +439,7 @@ class TestApp {
417
439
zoom ?: number ;
418
440
options ?: google . maps . MapOptions ;
419
441
mapTypeId ?: google . maps . MapTypeId ;
442
+ mapId ?: string ;
420
443
421
444
handleClick ( event : google . maps . MapMouseEvent ) { }
422
445
handleCenterChanged ( ) { }
0 commit comments