Components: help([google-maps]): [Working example of testing a component which uses a google map]

Created on 26 Mar 2020  Â·  5Comments  Â·  Source: angular/components

Is there an example project somewhere showing how to test a component using a google-map component ? I've tried a lot of things, but I had to give up.

For example I tried using the following code in my beforeEach :

    mapSpy = createMapSpy(DEFAULT_OPTIONS);
    mapConstructorSpy = createMapConstructorSpy(mapSpy);

But I still get an error such as "Uncaught TypeError: googleMap.setOptions is not a function "

google-maps needs clarification troubleshooting

Most helpful comment

Am having the same problem with Angular 9.1 where I'm getting ReferenceError: google is not defined in my unit tests, so I'd love to see a working example too..

All 5 comments

Am having the same problem with Angular 9.1 where I'm getting ReferenceError: google is not defined in my unit tests, so I'd love to see a working example too..

âž•

We've got tests for the Google Map and related components that can be used as a reference: https://github.com/angular/components/blob/master/src/google-maps/google-map/google-map.spec.ts#L56

@vbourdeix your test seems to be failing because your mock is incomplete.

Closing because this issue has been inactive for 2 weeks or more after follow up was requested.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vitaly-t picture vitaly-t  Â·  3Comments

julianobrasil picture julianobrasil  Â·  3Comments

RoxKilly picture RoxKilly  Â·  3Comments

jelbourn picture jelbourn  Â·  3Comments

savaryt picture savaryt  Â·  3Comments