title: How to query textarea elements by value using react-testing-library and Jest?
body: <p>I am working on a text-editing webapp and use react-testing-library and jest for testing. The app has a dynamic number of textareas and in order to test behavior I want to get a reference to a textarea using it's known value, however, I am unable to get this to work using RTL's queries.</p>
  <p>I tried both <code>getByText('known cell content')</code> and <code>getByDisplayValue('known cell content')</code>, and both fail the test with the message that the text could not be found. The text queried for is obviously present in the accompanying DOM printout:</p>
  <pre><code>TestingLibraryElementError: Unable to find an element with the text: som impliserer at . This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
  
   ...
                &lt;textarea
                  class=&quot;InputCellstyled__InputCellStyled-sc-1qia2ur-0 cntSTH&quot;
                &gt;
                   R'(t) = 240t^2 + 20t^3 - 10t^4 = -10t^2(t-6)(t+4) = 0
                &lt;/textarea&gt;
                &lt;textarea
                  class=&quot;InputCellstyled__InputCellStyled-sc-1qia2ur-0 cntSTH&quot;
                &gt;
                  som impliserer at &lt;--- WHY IS THIS NOT FOUND?
                &lt;/textarea&gt;
                &lt;textarea
                  class=&quot;InputCellstyled__InputCellStyled-sc-1qia2ur-0 cntSTH&quot;
                &gt;
                  t = -4 \quad , \quad t = 6 \quad \text{ eller } \quad t=0.
                &lt;/textarea&gt;
  </code></pre>
  <p>My current workaround is this tedious bit of code:</p>
  <pre class="lang-js prettyprint-override"><code>Array.from(document.querySelectorAll('textarea')).filter(
        (taEl) =&gt; taEl.value === 'known cell content'
      )[0];
  </code></pre>
  <p>This works, but I would much rather use RTL. How can I query textarea elements by value using RTL's queries?</p>
  <p>Thanks!</p>