feat(dom): toContainHTML#173
Open
JDOM10 wants to merge 2 commits into
Open
Conversation
KeylaMunnoz
reviewed
Jun 16, 2026
KeylaMunnoz
left a comment
Collaborator
There was a problem hiding this comment.
Hey @JDOM10 this looks great! I have just a small observation. I’m wondering if using a raw .includes() on outerHTML might end up being a bit brittle for developers using the matcher. Since it's a strict string comparison, differences in formatting could easily cause tests to fail even when the HTML is structurally identical, for example::
- Single quotes vs double quotes (class='foo' vs class="foo")
- Extra spaces or newlines in the test string
- Different attribute ordering (which browsers/JSDOM sometimes serialize differently)
- Tag case sensitivity (like
<span>vs<SPAN>)
Do you think this is something worth looking into? Maybe normalizing both the expected HTML and the actual HTML before comparing them, maybe by parsing them through a dummy element first? Let me know what you think! 😸
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added toContainHTML matcher