11import { Component , ViewChild } from '@angular/core' ;
2- import { TestBed , fakeAsync , flush } from '@angular/core/testing' ;
2+ import { TestBed } from '@angular/core/testing' ;
33import { By } from '@angular/platform-browser' ;
44
55import { DEFAULT_OPTIONS , GoogleMap } from '../google-map/google-map' ;
@@ -38,19 +38,18 @@ describe('MapCircle', () => {
3838 ( window . google as any ) = undefined ;
3939 } ) ;
4040
41- it ( 'initializes a Google Map Circle' , fakeAsync ( ( ) => {
41+ it ( 'initializes a Google Map Circle' , ( ) => {
4242 const circleSpy = createCircleSpy ( { } ) ;
4343 const circleConstructorSpy = createCircleConstructorSpy ( circleSpy ) ;
4444
4545 const fixture = TestBed . createComponent ( TestApp ) ;
4646 fixture . detectChanges ( ) ;
47- flush ( ) ;
4847
4948 expect ( circleConstructorSpy ) . toHaveBeenCalledWith ( { center : undefined , radius : undefined } ) ;
5049 expect ( circleSpy . setMap ) . toHaveBeenCalledWith ( mapSpy ) ;
51- } ) ) ;
50+ } ) ;
5251
53- it ( 'sets center and radius from input' , fakeAsync ( ( ) => {
52+ it ( 'sets center and radius from input' , ( ) => {
5453 const center : google . maps . LatLngLiteral = { lat : 3 , lng : 5 } ;
5554 const radius = 15 ;
5655 const options : google . maps . CircleOptions = { center, radius} ;
@@ -61,12 +60,11 @@ describe('MapCircle', () => {
6160 fixture . componentInstance . center = center ;
6261 fixture . componentInstance . radius = radius ;
6362 fixture . detectChanges ( ) ;
64- flush ( ) ;
6563
6664 expect ( circleConstructorSpy ) . toHaveBeenCalledWith ( options ) ;
67- } ) ) ;
65+ } ) ;
6866
69- it ( 'gives precedence to other inputs over options' , fakeAsync ( ( ) => {
67+ it ( 'gives precedence to other inputs over options' , ( ) => {
7068 const center : google . maps . LatLngLiteral = { lat : 3 , lng : 5 } ;
7169 const radius = 15 ;
7270 const expectedOptions : google . maps . CircleOptions = { ...circleOptions , center, radius} ;
@@ -78,12 +76,11 @@ describe('MapCircle', () => {
7876 fixture . componentInstance . center = center ;
7977 fixture . componentInstance . radius = radius ;
8078 fixture . detectChanges ( ) ;
81- flush ( ) ;
8279
8380 expect ( circleConstructorSpy ) . toHaveBeenCalledWith ( expectedOptions ) ;
84- } ) ) ;
81+ } ) ;
8582
86- it ( 'exposes methods that provide information about the Circle' , fakeAsync ( ( ) => {
83+ it ( 'exposes methods that provide information about the Circle' , ( ) => {
8784 const circleSpy = createCircleSpy ( circleOptions ) ;
8885 createCircleConstructorSpy ( circleSpy ) ;
8986
@@ -92,7 +89,6 @@ describe('MapCircle', () => {
9289 . query ( By . directive ( MapCircle ) ) !
9390 . injector . get < MapCircle > ( MapCircle ) ;
9491 fixture . detectChanges ( ) ;
95- flush ( ) ;
9692
9793 circleComponent . getCenter ( ) ;
9894 expect ( circleSpy . getCenter ) . toHaveBeenCalled ( ) ;
@@ -108,16 +104,15 @@ describe('MapCircle', () => {
108104
109105 circleSpy . getVisible . and . returnValue ( true ) ;
110106 expect ( circleComponent . getVisible ( ) ) . toBe ( true ) ;
111- } ) ) ;
107+ } ) ;
112108
113- it ( 'initializes Circle event handlers' , fakeAsync ( ( ) => {
109+ it ( 'initializes Circle event handlers' , ( ) => {
114110 const circleSpy = createCircleSpy ( circleOptions ) ;
115111 createCircleConstructorSpy ( circleSpy ) ;
116112
117113 const addSpy = circleSpy . addListener ;
118114 const fixture = TestBed . createComponent ( TestApp ) ;
119115 fixture . detectChanges ( ) ;
120- flush ( ) ;
121116
122117 expect ( addSpy ) . toHaveBeenCalledWith ( 'center_changed' , jasmine . any ( Function ) ) ;
123118 expect ( addSpy ) . toHaveBeenCalledWith ( 'click' , jasmine . any ( Function ) ) ;
@@ -132,16 +127,15 @@ describe('MapCircle', () => {
132127 expect ( addSpy ) . not . toHaveBeenCalledWith ( 'mouseup' , jasmine . any ( Function ) ) ;
133128 expect ( addSpy ) . not . toHaveBeenCalledWith ( 'radius_changed' , jasmine . any ( Function ) ) ;
134129 expect ( addSpy ) . toHaveBeenCalledWith ( 'rightclick' , jasmine . any ( Function ) ) ;
135- } ) ) ;
130+ } ) ;
136131
137- it ( 'should be able to add an event listener after init' , fakeAsync ( ( ) => {
132+ it ( 'should be able to add an event listener after init' , ( ) => {
138133 const circleSpy = createCircleSpy ( circleOptions ) ;
139134 createCircleConstructorSpy ( circleSpy ) ;
140135
141136 const addSpy = circleSpy . addListener ;
142137 const fixture = TestBed . createComponent ( TestApp ) ;
143138 fixture . detectChanges ( ) ;
144- flush ( ) ;
145139
146140 expect ( addSpy ) . not . toHaveBeenCalledWith ( 'dragend' , jasmine . any ( Function ) ) ;
147141
@@ -151,7 +145,7 @@ describe('MapCircle', () => {
151145
152146 expect ( addSpy ) . toHaveBeenCalledWith ( 'dragend' , jasmine . any ( Function ) ) ;
153147 subscription . unsubscribe ( ) ;
154- } ) ) ;
148+ } ) ;
155149} ) ;
156150
157151@Component ( {
0 commit comments