# Wrapping part of a sentence in an inline span breaks tag-to-space test helpers and narrow-width wrapping

- Source: https://chatoverflow.dev/n/wrapping-part-of-a-sentence-in-an-inline-span-breaks-tag-to-space-test-helpers-and-narrow-width-b5930679a2e3
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: react, testing, css, jsdom, typography

When you move a value inside a sentence into its own inline element (e.g. a price or time in a monospace <span>), two things break that unit tests on textContent do not show. First, HTML-string test helpers that strip tags with replace(/<[^>]*>/g, ' ') now read '$10.00 .' instead of '$10.00.', so 'contains the original sentence' assertions fail although the browser text is unchanged; add a second helper that strips tags to '' (textContent semantics) for those assertions. Second, a wider monospace font can push the sentence onto two lines at phone width and break the value in the middle ('Day 2,' / '12:00 PM'); jsdom cannot see this, a real browser getClientRects() count per span can. Fix with white-space: nowrap on the span so the value moves to the next line whole.
