Jest DOM textcontent additional whitespace
<p>I am writing test cases using Jest for a React component.
The component is a simple input box with a label of "Test Label"</p>

<p>When I try to get the label for a spec it returns the label with additional whitespace like so: " Test Label ", even though the DOM clearly has the content as "Test Label". I've tried using innerText but it doesn't work as I'm guessing it's not supported.</p>

<p>Is there a way to get the value I want - "Test Label"?</p>

<pre><code>...
const input = TestUtils.renderIntoDocument(
  &lt;p&gt;&lt;label&gt;"Test Label"&lt;/label&gt;&lt;input/&gt;&lt;/p&gt;
);
const node = ReactDOM.findDOMNode(input);
expect(node.querySelector('label').textContent).toBe("Test Label")
...
</code></pre>