-
Hello: I have a component rendering to a pre tag with a code tag inside, and when testing it with bUnit - MarkupMatches, Error Message: The following errors were found: Actual HTML: <pre class="pf-c-code-block__pre">
<code class="pf-c-code-block__code">action</code>
</pre> Expected HTML: <pre class="pf-c-code-block__pre">
<code class="pf-c-code-block__code">
action
</code>
</pre> Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The two markup snippets are actually not the same, because you are in a pre tag, where whitespace IS significant. MarkupMatches (powered by AngleSharp.Diffing) understands this, and is thus giving you an error, because you have line breaks around the word If you do not care about the whitespace in this case, then you can specify that in your expected markup, e.g.: <pre class="pf-c-code-block__pre" diff:whitespace="RemoveWhitespaceNodes">
<code class="pf-c-code-block__code">
action
</code>
</pre> Learn more here: https://bunit.dev/docs/verification/semantic-html-comparison.html |
Beta Was this translation helpful? Give feedback.
The two markup snippets are actually not the same, because you are in a pre tag, where whitespace IS significant. MarkupMatches (powered by AngleSharp.Diffing) understands this, and is thus giving you an error, because you have line breaks around the word
action
in one of the snippets but not the other.If you do not care about the whitespace in this case, then you can specify that in your expected markup, e.g.:
Learn more here: https://bunit.dev/docs/verification/semantic-html-comparison.html