title: Cypress: check for an empty element
body: <p>My question is fairly simple but I didn't find any answer that corresponds to it yet, how can I assert that an element is empty with Cypress ? I just want to make sure that the element doesn't contain text.</p>
  <p>My initial trial was</p>
  <pre><code>cy.find('.someElement').should('have.text', '');
  </code></pre>
  <p>But I ran into this error even though my div was empty in the DOM</p>
  <pre><code>expected '&lt;div.someElement&gt;' to have text '', but the text was '\n \n \n      '
  </code></pre>
  <p>I got it to work using</p>
  <pre><code> cy.find('.someElement')
      .should(($el) =&gt; {
        expect($el.text().trim()).equal('');
      });
  </code></pre>
  <p>but I don't understand why I have to trim the text of the element.</p>