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

doc: Better documentation for toContaintHTML #363

Merged
merged 2 commits into from
May 15, 2021
Merged

doc: Better documentation for toContaintHTML #363

merged 2 commits into from
May 15, 2021

Conversation

gnapse
Copy link
Member

@gnapse gnapse commented May 5, 2021

What:

More explicit requirements in the documentation of toContainHTML.

Why:

#362 (comment)

How:

Checklist:

  • Documentation
  • Ready to be merged

Fixes #362.

@gnapse gnapse self-assigned this May 5, 2021
@codecov
Copy link

codecov bot commented May 5, 2021

Codecov Report

Merging #363 (dbb0183) into main (637529e) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #363   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines          554       554           
  Branches       199       199           
=========================================
  Hits           554       554           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 637529e...dbb0183. Read the comment docs.

@gnapse gnapse requested review from a team, benmonro and eps1lon May 5, 2021 22:03
@gnapse
Copy link
Member Author

gnapse commented May 5, 2021

I tagged some folks here to get an approving review and a second pair of eyes and your opinion. Thanks!

README.md Outdated
@@ -491,7 +491,7 @@ toContainHTML(htmlText: string)
```

Assert whether a string representing a HTML element is contained in another
element:
element. The string should contain valid html, and not any substrings of html.
Copy link
Member

@eps1lon eps1lon May 5, 2021

Choose a reason for hiding this comment

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

"substrings of html" is a bit unclear to me. It sounds like <p></p> would be considered a "substring" but that's valid HTML. An example would help here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree this is probably not the clearest terms. But the examples are below. Do you think we need examples of what won't work? Like for instance, this:

// These won't work
render(<div class="test">text</div>)
expect(element).toContainHTML('</div>')
expect(element).toContainHTML('class="test"')

Copy link
Member

Choose a reason for hiding this comment

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

I think "partial HTML" or "incomplete HTML" is more fitting here.

Oh and move the comment since the render does work.

-// These won't work
render(<div class="test">text</div>)
+// These won't work
expect(element).toContainHTML('</div>')
expect(element).toContainHTML('class="test"')

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool. Thanks for your advice. I'll do that.

@gnapse gnapse requested a review from eps1lon May 15, 2021 02:13
@gnapse gnapse merged commit c816955 into main May 15, 2021
@gnapse gnapse deleted the gnapse-patch-1 branch May 15, 2021 17:11
@github-actions
Copy link

github-actions bot commented Jun 3, 2021

🎉 This PR is included in version 5.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Version 5.11.10 broke toContainHTML
2 participants