dangerouslySetInnerHTML and text() not outputting
Open
API: shallow
bug
- Dominant language
- JavaScript
- Stars
- 19.8k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
I have a simple `
` component that has a `dangerouslySetInnerHTML` and when doing a shallow render of:
```
```
`_wrapper.find('p').text()` doesn't return 'blah' as expected.
`_wrapper.find('p').html()` returns 'blah' wrapped in the `
` tag.
Have a [branch](https://github.com/silasb/enzyme/tree/dangerouslySetInnerHTML-node-text-func-error) that proves that `text()` doesn't work
Contributor guide
Research direction
Start with the dangerouslySetInnerHTML-node-text-func-error branch and reproduce the shallow render using find('p').text() and find('p').html(). Compare the two traversal results and confirm that text() returns 'blah' while html() returns the content wrapped in the p tag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100