HTML span elements inside not passing automated tests for nutrition label project [closed]

6 days ago 7
ARTICLE AD BOX

Your HTML is visually correct, but the automated test is failing because it checks the exact textContent and node order, not how it looks in the browser.

Line breaks and indentation inside the <p> create extra whitespace text nodes, which causes the test to fail.

The <p> must contain the text exactly:

Total Fat 8g 10%

with:

one <span class="bold"> around Total Fat

plain text 8g

one <span class="bold"> around 10%

Put everything on one line with explicit spaces:

<p><span class="bold">Total Fat</span> 8g <span class="bold">10%</span></p>

This removes extra whitespace nodes and matches what the automated test expects.


Read Entire Article