Skip to content

Conversation

@littlejon
Copy link
Contributor

Sorry I haven't opened an issue for this, I forked the repo to see if exporting the Autocomplete class worked for my testing need.

FYI - this change fixed my problem to allow

beforeEach(() => {
  initialize();
});

describe("GooglePlaceAutocomplete", () => {
  const callback = jest.fn();

  const requiredProps = {
    initialValue: undefined,
    callback,
  };

  const renderComponent = (props = requiredProps) =>
    render(<GooglePlaceAutocomplete {...props} />);

  it("renders", async () => {
    renderComponent();

    const autoComplete = mockInstances.get(Autocomplete)[0];

    act(() => {
      autoComplete.addListener.mock.calls[0][1]();
    });

    await waitFor(() => {
      expect(
        screen.getByTestId("google-place-autocomplete")
      ).toBeInTheDocument();
      expect(autoComplete.addListener).toBeCalledTimes(1);
      expect(autoComplete.getPlace).toBeCalled();
      expect(callback).toBeCalledWith({ name: "" });
    });
  });
});

@google-cla
Copy link

google-cla bot commented Jul 9, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link

@Tomino2112 Tomino2112 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the same issue, can't see anything wrong with this PR

@Tomino2112
Copy link

Can someone merge this please? Makes some stuff untestable

@amuramoto amuramoto merged commit 6c01b91 into googlemaps:main Feb 9, 2023
googlemaps-bot pushed a commit that referenced this pull request Feb 9, 2023
## [2.8.0](v2.7.9...v2.8.0) (2023-02-09)

### Features

* Export Places Autocomplete and SearchBox ([#287](#287)) ([6c01b91](6c01b91))

### Bug Fixes

* sets semantic release to v19 ([#377](#377)) ([5bcb580](5bcb580))

### Miscellaneous Chores

* **deps-dev:** bump @rollup/plugin-typescript from 10.0.1 to 11.0.0 ([#366](#366)) ([a5a2d77](a5a2d77))
* **deps-dev:** bump eslint-config-prettier from 8.5.0 to 8.6.0 ([#367](#367)) ([b480632](b480632))
* **deps-dev:** bump eslint-plugin-jest from 27.1.6 to 27.1.7 ([#358](#358)) ([353b0d5](353b0d5))
* **deps-dev:** bump eslint-plugin-jest from 27.1.7 to 27.2.0 ([#364](#364)) ([0d147ab](0d147ab))
* **deps-dev:** bump eslint-plugin-jest from 27.2.0 to 27.2.1 ([#368](#368)) ([9dc06c7](9dc06c7))
* **deps-dev:** bump prettier from 2.8.0 to 2.8.1 ([#357](#357)) ([1f21ecf](1f21ecf))
* **deps-dev:** bump typedoc from 0.23.21 to 0.23.22 ([#353](#353)) ([4c6376e](4c6376e))
* **deps-dev:** bump typedoc from 0.23.22 to 0.23.23 ([#360](#360)) ([1a99df6](1a99df6))
* **deps-dev:** bump typedoc from 0.23.23 to 0.23.24 ([#365](#365)) ([79b27c9](79b27c9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants