title: Assert the width of an image using React Testing Library
body: <p>Say I have a simple image based component:</p>
  <pre><code>// ./Figure.js
  
  const Figure = ({src}) =&gt; (
      &lt;img
          src={src}
          width=&quot;100%&quot;
      /&gt;
  );
  </code></pre>
  <p>I want to test that its width is <code>100%</code>.</p>
  <p>My test:</p>
  <pre><code>// ./Figure.test.js
  
  import Figure from './Figure'
  import { render, screen } from '@testing-library/react'
  
  describe('Figure', () =&gt; {
      const setup = () =&gt; {
          return render(
              &lt;Figure
                  src=&quot;https://src.com&quot;
              /&gt;
          )
      }
  
      it('has the right width', () =&gt; {
          setup()
  
          const image = screen.getByAltText('alt')
  
          expect(image.src).toBe('https://src.com/')
          expect(image.width).toBe(&quot;100%&quot;)
      })
  })
  </code></pre>
  <p>However, that gives me an error:</p>
  <pre><code>  ● Figure › renders
  
      expect(received).toBe(expected) // Object.is equality
  
      Expected: &quot;100%&quot;
      Received: 0
  </code></pre>
  <p>Question: How can I assert the width of an image using React Testing Library without using snapshots?</p>