Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistake in the homepage doc for shallow? #39

Closed
ericelliott opened this issue Dec 4, 2015 · 4 comments
Closed

Mistake in the homepage doc for shallow? #39

ericelliott opened this issue Dec 4, 2015 · 4 comments
Assignees
Labels

Comments

@ericelliott
Copy link

There's an example of simulating click events using the shallow renderer:

  it('simulates click events', () => {
    const onButtonClick = sinon.spy();
    const wrapper = shallow(
      <Foo onButtonClick={onButtonClick} />
    );
    wrapper.find('button').click();
    expect(onButtonClick.calledOnce).to.be.true;
  });

But when I try to use it, I get this:

$.find('.' + helloClass).click();
                             ^

TypeError: $.find(...).click is not a function

I didn't search meticulously, but I don't see a .click() method in the source... where is it?

@ericelliott
Copy link
Author

Also doesn't appear in the shallow.md API docs. =)

@lelandrichardson
Copy link
Collaborator

This is definitely a mistake. Thank you for pointing out.

wrapper.find('button').simulate('click')

Is what you're looking for. I'll fix!

@lelandrichardson
Copy link
Collaborator

PR Opened.

@ericelliott
Copy link
Author

haha, I thought I already opened a PR for this. Where is my brain?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants