google-maps-react icon indicating copy to clipboard operation
google-maps-react copied to clipboard

Unable to access/reach the map container (component) holding the google map

Open ShreeGiriKumar opened this issue 5 years ago • 0 comments

How to access my functional component 'GoogleReactMap' which is holding the map,

`import React, { useState, useEffect } from "react"; import { Map, GoogleApiWrapper, Marker } from "google-maps-react";

function GoogleReactMap(props) {

return (
    <Map
        google={props.google}
        zoom={8}
        style={{
            width: "380px",
            height: "280px",
            position: "relative"
        }}
        initialCenter={{ lat: props.lat, lng: props.long }}
    >
        <Marker position={{ lat: props.lat, lng: props.long }} />
    </Map>
);

}

export default GoogleApiWrapper({ apiKey: "$$^%^$RTFGFDF" })(GoogleReactMap);`

Jest & Enzyme, is able to only dive to the Google Map component, `it('render google react map', () => { const props = { lat: "35.929673", long: "-78.948237" };

    let wrapper = mount(<GoogleReactMap props={props} lat={"35.929673"} long={"-78.948237"} google={global.google}  />);
 expect(wrapper).toBeDefined();
});`

<Wrapper props={{...}} lat="35.929673" long="-78.948237" google={[undefined]}> <DefaultLoadingContainer> <div> Loading... </div> </DefaultLoadingContainer> </Wrapper>

Please help.

ShreeGiriKumar avatar Nov 28 '20 17:11 ShreeGiriKumar