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

$.find('.myclass').first().html() #41

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

$.find('.myclass').first().html() #41

ericelliott opened this issue Dec 4, 2015 · 5 comments

Comments

@ericelliott
Copy link

$.find(`.${ props.helloClass }`).first().html()
/Users/eric/Dropbox/dev/react-pure-component-starter/node_modules/fbjs/lib/invariant.js:45
    throw error;
    ^

Error: Invariant Violation: renderToStaticMarkup(): You must pass a valid ReactElement.

Ok... maybe it didn't find anything?

$.find(`.${ props.helloClass }`).first().length // 1

Looks like it found something. How do I see what it found without a working .html()?

I'd love to step through and find out, but I'm struggling to get iron-node or node-inspector to work on the tests. Wish I had more time to dig in.

Any hints?

@ericelliott
Copy link
Author

Using cheerio directly, this just works with no fuss:

$(`.${ props.helloClass }`).html()

@lelandrichardson
Copy link
Collaborator

@ericelliott in your example, is the $ the result of a render() call or shallow() or what?

@ericelliott
Copy link
Author

Sorry, shallow.

@lelandrichardson
Copy link
Collaborator

@ericelliott can you send me a reproducible base case? .html() seems to be working for me when I try it.

Also, check out .debug() too, which is meant to help you "see what it found" when working with shallow.

@ericelliott
Copy link
Author

Also, check out .debug() too, which is meant to help you "see what it found" when working with shallow.

Thanks for the tip. I'll revisit this later. Closing for now.

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

No branches or pull requests

2 participants